2016-06-10 62 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]),