【发布时间】:2016-09-13 12:15:01
【问题描述】:
如何在下面的行中检索$rootScope 值?
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
// Here is where I need to get the value of $rootScope.
}
【问题讨论】:
-
在
config(configuration) 阶段$rooScope(scope) 的应用程序尚未创建,所以你不能在那里获得$rootScope,你可以使用.run阻止你可以注入和使用$rootScope -
你能举个例子吗?谢谢
-
.run(function($rootScope){ /* use $rootScope here */ })
标签: javascript android html angularjs ionic-framework