Javascript 访问自定义服务的config属性
我正在尝试将自定义服务访问到其config属性中,以注入http拦截器Javascript 访问自定义服务的config属性,javascript,angularjs,Javascript,Angularjs,我正在尝试将自定义服务访问到其config属性中,以注入http拦截器 angular .module("common.services") .factory("redirectService", ["$resource", "$q", "$location", redirectService]), .config(function ($httpProvider)
angular
.module("common.services")
.factory("redirectService",
["$resource", "$q", "$location",
redirectService]),
.config(function ($httpProvider) {
$httpProvider.interceptors.push('redirectService');
});
function redirectService($resource, $q, $location){
...
}
但显然这是不正确的,因为我得到了firebug控制台错误
SyntaxError:应为表达式,获取了“.”.config(函数
($httpProvider){
从中删除最后一个
,
.factory("redirectService",
["$resource", "$q", "$location",
redirectService]),
从中删除最后一个
,
.factory("redirectService",
["$resource", "$q", "$location",
redirectService]),