我想在provider方法中处理$ rootScope。我不知道如何注射它
that.app.config ['$authProvider', ($authProvider) ->
$authProvider.configure
apiUrl: '/api/v1'
handleTokenValidationResponse: (response) ->
// How to handle $rootScope here?
return response
]
答案 0 :(得分:2)
在提供程序功能中,您无法注入任何服务或工厂。这只能在" $ get"方法
this.$get = function($injector) {
return function(exception,cause){
var rScope = $injector.get('$rootScope');
rScope.$broadcast('exception',exception, cause);
}
};