Javascript 如何在provider的配置中处理$rootScope
我想在provider方法中处理$rootScope。我不知道怎么注射Javascript 如何在provider的配置中处理$rootScope,javascript,angularjs,Javascript,Angularjs,我想在provider方法中处理$rootScope。我不知道怎么注射 that.app.config ['$authProvider', ($authProvider) -> $authProvider.configure apiUrl: '/api/v1' handleTokenValidationResponse: (response) -> // How to handle $rootScope here?
that.app.config ['$authProvider', ($authProvider) ->
$authProvider.configure
apiUrl: '/api/v1'
handleTokenValidationResponse: (response) ->
// How to handle $rootScope here?
return response
]
在provider函数中,不能注入任何服务或工厂。这只能在“$get”方法中完成
看起来像是咖啡脚本。您可能希望将其添加为标记。您无法在配置级别访问rootScope,而且
auth
在我看来服务不是配置
this.$get = function($injector) {
return function(exception,cause){
var rScope = $injector.get('$rootScope');
rScope.$broadcast('exception',exception, cause);
}
};