ホームページ  >  記事  >  ウェブフロントエンド  >  AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?

AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?

寻∝梦
寻∝梦オリジナル
2018-09-08 14:33:241629ブラウズ

この記事では、angularjsツールの使い方と、angularjsでのjQueryの使い方の詳細を中心に紹介していますので、一緒に見ていきましょう。

1. Angularjs ツールメソッド

(1)angular.isArray(value) は配列かどうかを判断し、true/false を返します

<p>{{isArray}}</p>
$scope.arr=[1,2,3];
$scope.isArray=angular.isArray($scope.arr);

(2)angular.isDate(value) は配列であるかどうかを判断します日付型で true/false を返します

(3)angular.idDefined(value) 定義されているかどうかを判断し、true/false を返します

(4)angular.isElement(node) DOM ノードであるかどうかを判断し、true/を返しますfalse

(5) angular.isFunction(value) は、Function 型であるかどうかを判断し、true/false を返します

(6) angular.isNumber(value) は、NaN、Infinity、-Infinity を含む Number 型であるかどうかを判断します、true/falseを返します

(7)angular.isObject(value)は、オブジェクト型であるかどうかを決定し、Arrayはオブジェクト型であり、Nullはオブジェクト型ではありません、true/false

(8)angular.isStringを返します(value) は文字列型かどうかを判断し、true/false を返します

(9)angular.uppercase(value) 大文字に変換

<p>{{name1}}</p>
 $scope.name='zhangsan';
 $scope.name1=angular.uppercase($scope.name);

(10)angular. lowercase(value) 小文字に変換

(11)angular .equals(o1,o2) 2 つの文字列が等しいかどうかを判断し、true/false を返します

<p>{{eq}}</p>
$scope.a='111';
$scope.b='111';
$scope.eq=angular.equals($scope.a,$scope.b);

(12)angular.extend(dst,src) 継承関係。次のコードに示すように、b は a

$scope.a={name:'张三'};
$scope.b={age:10};
$scope.c=angular.extend($scope.b,$scope.a);
console.log($scope.b);//{"age":10,"name":"张三"}
の属性を継承します。

(13)angular.fromJson(json) json文字列を逆シリアル化し、json文字列をJavaScriptオブジェクトに変換します

 var json = '{"name":"hello","age":"20"}';
 console.log(json);
 $scope.json=angular.fromJson(json);
 console.log($scope.json);

AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?

(14)angular.toJson(obj,pretty) json文字列をフォーマットします

 var json = {"name":"hello","age":"20"};
 // console.log(json);
 // $scope.json=angular.toJson(json);
 $scope.json=angular.toJson(json,true);
 console.log($scope.json);

AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?(15)angular .コピー( ソース,[宛先]) 次のコードに示すように、a を b


にコピーします。
              $scope.a={name:'张三'};
              $scope.b={age:10};
              $scope.c=angular.copy($scope.a,$scope.b);
              console.log($scope.a);
              console.log($scope.b);

AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?(16)angular.forEach(obj, iterator, [context]) 

              var json = {"name":"hello","age":"20","sex":'男'};
              angular.forEach(json,function(val,key){
                    //console.log(val);
                  console.log(key);
              });

AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?

              var json = {"name":"hello","age":"20","sex":'男'};
              var results=[];
             angular.forEach(json,function(val,key){
                  //console.log(val);
                  //console.log(key);
                  this.push(key+'--'+val);
              },results);
              console.log(results);

(17)angular.bind(self, fn, args);绑定对象,作为函数的上下文


              var self={name:'张三'};
              var f=angular.bind(self,function(age){
                        $scope.info=this.name+' is '+age;
                        console.log($scope.info);
              });
              f(30);
              var f=angular.bind(self,function(age){
                  $scope.info=this.name+' is '+age;
                 console.log($scope.info);
              },10);
              f();

AngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?本篇文章到这就结束了(想看更多就到PHP中文网AngularJS使用手册中学习),有问题的可以在下方留言提问。

以上がAngularJS ツールの使用方法? AngularJS で jQuery を使用するにはどうすればよいですか?の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。