I'm building a small Angular app and I'm currently using ui-router.
I've hit a problem which looks awfully like a bug in ui-router but I can't be sure as I'm not that familiar with this library. When the user clicks on a specific link, although the correct view state gets loaded as expected, the URL in the address bar doesn't get updated.
I'm using ui-router's ui-sref
directive to automatically generate the URL for the state. For example in the checklist list view I use the following code:
<a ui-sref="checklist-phase({ aircraftId: checklist.aircraft, checklistId: checklist.id, phaseSlug: checklist.phases[0].slug })" ng-bind="checklist.name"></a>
I've cut down my app and made it into a Plunker so the problem is hopefully reproducible by others. The issue can also be observed in this video: https://www.youtube.com/watch?v=EW9CFe6LfCw
Reproduction steps:
- Go to http://run.plnkr.co/plunks/ZqMIYNU6abEAndAM5nx1/#/aircraft/1/checklists
- Click the first link. Notice that the view updates to show the correct state, but the URL remains at
/#/aircraft/1/checklists
.
What is strange is that navigating back to this state by other means updates the URL perfectly. For example (assuming steps 1 and 2 above have been followed):
- Scroll to the bottom and click the
Next Phase
link. Note that the state changes and the URL updates. - Scroll down on this new view and click
Previous Phase
. Note that the previous state reloads and this time the URL it updated correctly.
Am I using ui-router incorrectly or doing something else incorrectly to cause this behaviour?