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