标签:
In Angular, a Controller is a JavaScript constructor function that is used to augment the Angular Scope.
When a Controller is attached to the DOM via the ng-controller directive, Angular will instantiate a new Controller object, using the specified Controller’s constructor function. A new child scope will be available as an injectable parameter to the Controller’s constructor function as $scope.
在Angular里,控制器就是一个用来增强Scope的JavaScript的构造函数。 当一个控制器通过ng-controller指令被附在DOM上的时候,Angular就会用这个指定的构造函数,初始化一个新的控制器实例。同时,1个子scope会以$scope的名字的变量身份,被注入到新的构造函数里。
标签:
原文地址:http://www.cnblogs.com/amile1860/p/4518395.html