0
後,我有以下一個div,NG-包括不工作攔截
<div id="contenido" ng-include="'partials/busqueda.html'"> </div>
添加攔截到我的網頁它停止工作後,
app.factory('authInterceptor', function($q, Auth) {
return {
request: function (config) {
var deferred = $q.defer();
if (Auth.authz.token) {
Auth.authz.updateToken(5).success(function() {
config.headers = config.headers || {};
config.headers.Authorization = 'Bearer ' + Auth.authz.token;
deferred.resolve(config);
}).error(function() {
deferred.reject('Failed to refresh token');
});
}
return deferred.promise;
}
};
});
app.config(function($httpProvider) {
$httpProvider.interceptors.push('errorInterceptor');
$httpProvider.interceptors.push('authInterceptor');
});
如果我評論了線$ httpProvider .interceptors.push('authInterceptor'); ng-include再次運行