Skip to content Skip to sidebar Skip to footer

Angular-ui-router Isn't Fulfilling State Resolve Promises When Page Refreshes Or Deep Linked

Using AngularJS 1.2.16, ui-router, and Restangular (for API services), I have an abstract state with a child state that uses multiple views. The child view accepts a URL parameter

Solution 1:

Firstly just a note. If you have routing issues (like those with ui-router), instead of using a fiddle, you can just use something like pastebin to provide a single complete demo file that can be run locally, so that the route issues can be tested.

I have created one of those from your fiddle: here

The interesting thing is, that your mock demo seems to work perfectly fine with regards to routing. This makes me think that the issue lies somewhere in your production service. One thing that used to annoy me with ui-router was the difficulty in solving resolve bugs, as there seemed to be little to no error reporting.

If you add this to your apps run function (as I have done in the link above), you should get better resolve error output:

// handle any route related errors (specifically used to check for hidden resolve errors)$rootScope.$on('$stateChangeError', function(event, toState, toParams, fromState, fromParams, error){ 
    console.log(error);
});

Post a Comment for "Angular-ui-router Isn't Fulfilling State Resolve Promises When Page Refreshes Or Deep Linked"