您的位置:首页 > Web前端 > AngularJS

angular api

2016-04-25 11:34 561 查看
1.angular.bind –上下文绑定,类似js call \apply\bind

var obj = { name: "Any" };
var fn = function (Adj) {
console.log(this.name + "is a boy!!! And he is " + Adj + " !!!");
};
var f = angular.bind(obj, fn, "handsome");
f();//Any is a boy!!! And he is handsome!!!
var t = angular.bind(obj, fn);
t("ugly");// Any is a boy!!! And he is ugly!!!


2.angular.bootstrap—手动加载,局部or整体刷新数据“`

var app = angular.module(‘demo’, [])

.controller(‘WelcomeController’, function(scope) {scope) {
scope.greeting = ‘Welcome!’;

});

angular.bootstrap(document, [‘demo’]);

// 页面加载完成后,再加载模块

angular.element(document).ready(function() {

angular.bootstrap(document.getElementById(“div1”),[“moudle1”]);

angular.bootstrap(document.getElementById(“div2”),[“moudle2”]);

});

3.angular.copy 深度copy


$scope.master= angular.copy(user);
};
angular.copy($scope.master, $scope.user);


“`
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: