1

The app I'm writing is using the resolve property in the main UI router state. It tries to resolve to a list of things, using a factory that uses $http. So I was trying to implement error handling, I changed my server to return a 404 status, and added thus lines:

$rootScope.$on('$stateChangeError', function(event) {
  $state.go('404');
});

as Nate Abele explained here: Angular UI router handling 404s

Now the app do try to change the state to my 404 state, but a very strange loop occurred. The app keep trying to resolve the failed factory from the resolve property. Haven't figured up why until now.

Any suggestions ? Thanks.

3
  • Can you please post a little more code to help us out? We def. need to see the resolve and 404 state definition, and anything else you think would, help us. The question you are referencing has no approved answers. C Commented Apr 29, 2014 at 12:53
  • Does your 404 state, by any chance, descend from the main state that contains the resolve? Commented May 1, 2014 at 15:45
  • you forgot to add event.preventDefault() Commented Feb 19, 2017 at 7:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.