angularjs中的run()方法使用

run方法用于初始化全局的数据,仅对全局作用域起作用。
举个栗子吧:
<script type="text/javascript">
var m1 = angular.module('myApp',[]);
m1.run(['$rootScope',function($rootScope){
$rootScope.name = 'hello';
}]);
console.log( m1 );
</script>
原文地址:https://www.cnblogs.com/huangshikun/p/7080992.html