angularjs英文版api學習 (附demo)

來源:互聯網
上載者:User

標籤:color   copy   foreach   inpu   add   end   fine   san   for   

1.angular.bind

var self = {name: ‘boy‘};var f = angular.bind(self, function (age) { alert(this.name + ‘ is ‘ + age + ‘ !‘)}); f(12);

2、angular.bootstrap

  var app = angular.module(‘demo‘, [])  .controller(‘WelcomeController‘, function($scope) {      $scope.greeting = ‘Welcome!‘;  });  angular.bootstrap(document, [‘demo‘]);

3、angular.copy

使用angular.copy拷貝後會指向一個新地址

4、angular.element

angular.element(document.getElementById(‘ddd‘)).addClass(‘ccc‘)

5、angular.equal(pram1,pram2);

angular.equal("a","a");//trueconsole.log(angular.equals(true,1));  //false 不能進行強轉化var a={a:111};var b={a:111};console.log(angular.equals(a, b));    //true

6、angular.forEach(Arr,fn,[context])

    //對象遍曆
var values = {name: ‘misko‘, gender: ‘male‘}; var log = []; angular.forEach(values, function(value, key) { log.push(key + ‘: ‘ + value); }); console.log(log);
//["name: misko", "gender: male"]
   var values = {name: ‘misko‘, gender: ‘male‘};
var log = [];   angular.forEach(values, function(value, key) {        this.push(key + ‘: ‘ + value);    },log);//["name: misko", "gender: male"]
    //數組遍曆    var values = [1,2,3];    var log = [];    angular.forEach(values, function(value, key) {        log.push(key + ‘: ‘ + value);    });    console.log(log);

7、angular.fromJson

    var json = ‘{"name":"liSi", "password":"321"}‘;    var jsonArr = ‘[{"name":"zhangSan", "password":"123"},{"name":"liSi", "password":"321"}]‘;    var obj = angular.fromJson(json);    console.log(obj);    var objArr = angular.fromJson(jsonArr);    console.log(objArr);

8、angular.identity

function getResult(fn, input) {  return (fn || angular.identity)(input);};getResult(function(n) { return n * 2; }, 21);   // returns 42getResult(null, 21);                            // returns 21getResult(undefined, 21);                       // returns 21

9、

angularjs英文版api學習 (附demo)

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.