run方法

Angularjs模块的run方法初始化全局的数据 ,只对全局作用域起作用 如$rootScope

<script type="text/javascript">
	var m1 = angular.module('myApp',[]);
	m1.run(['$rootScope',function($rootScope){
		$rootScope.name = 'hello';
	}]);
	console.log( m1 );
</script>

猜你喜欢

转载自liuna718-163-com.iteye.com/blog/2302174
run