我尝试将自定义服务访问其config属性以注入http拦截器,如
angular
.module("common.services")
.factory("redirectService",
["$resource", "$q", "$location",
redirectService]),
.config(function ($httpProvider) {
$httpProvider.interceptors.push('redirectService');
});
function redirectService($resource, $q, $location){
...
}
但显然这是不正确的,因为我得到了firebug控制台错误
SyntaxError:expect expression,got'。'的.config(功能 ($ httpProvider){
答案 0 :(得分:3)
从
中删除最后,
.factory("redirectService",
["$resource", "$q", "$location",
redirectService]),