2016-06-10 60 views
0

我试图访问我的定制服务为它的配置属性注入HTTP拦截像访问来配置我的自定义服务的属性

angular 
     .module("common.services")   
     .factory("redirectService", 
       ["$resource", "$q", "$location", 
       redirectService]), 
     .config(function ($httpProvider) { 
      $httpProvider.interceptors.push('redirectService'); 
     }); 
function redirectService($resource, $q, $location){ 
    ... 
} 

,但显然这是不正确的原因我越来越萤火控制台错误

SyntaxError: expected expression, got '.' .config(function ($httpProvider) {

回答

3

删除最后一个,

.factory("redirectService", 
    ["$resource", "$q", "$location", 
    redirectService]),