搜索
您的当前位置:首页正文

AngularJS run方法

来源:二三娱乐
run 方法初始化全局的数据 ,只对全局作用域起作用 如$rootScope
var m1 = angular.module('myApp',[]);
m1.run(['$rootScope',function($rootScope){
   $rootScope.name = 'hello';
}]);
Top