angularjs - Injecting $state (ui-router) causes circular dependency -
when put $state there error...how can fix it?
i want use $state navigate page dont know how ? suggestion ? there other way navigate user page ?
app.factory('mainauthinterceptorservice', ['$q','$state', '$injector', '$location', 'localstorageservice', function ($q,$state, $injector, $location, localstorageservice) {....}
im using
authservice.logout();
and need redirect user page ...
one simple fix use $injector service reference $state service, so:
app.factory('mainauthinterceptorservice', ['$q', '$injector', '$location', 'localstorageservice', function($q, $injector, $location, localstorageservice) { var $state = $injector.get('$state'); // inject state manually ... // interceptor logic }
you can use $state object usual.
there similar question created user great answer explains issue in depth: injecting $state (ui-router) $http interceptor causes circular dependency
Comments
Post a Comment