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.

Community
  • 1
  • 1
Daniel
  • 1,562
  • 3
  • 22
  • 34
  • 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 – Nix Apr 29 '14 at 12:53
  • Does your `404` state, by any chance, descend from the main state that contains the resolve? – Nate Abele May 01 '14 at 15:45
  • you forgot to add `event.preventDefault()` – Rathma Feb 19 '17 at 07:09

0 Answers0