阅读背景:

在使用AngularJS的工厂中,$ location.path不会更改

来源:互联网 

My factory looks like:

我的工厂看起来像:

'use strict';

angular.module('myApp')
  .factory('httpInterceptor',['$q','$location', '$rootScope', function($q, $location, $rootScope){
    return {
      response: function(response) {

        if(response.success === false) {
console.log("Redirecting");
            $location.path('/login');
            return $q.reject(response);
        }

        return response || $q.when(response);
      }
    }
}]);
'use stric



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: