Max
Max

Reputation: 708

Avoid page reload on URL change using UI-Router

I'm using ui-router to navigate within my web app.

I have a search page and I want the user to be able to save the URL with the current search string in it so he can share it.

To update the URL on each search string change without reloading the page I do like the documentation says :

$state.go('.', { searchString: $scope.searchString }, { location: 'replace', notify: false });

However depending on the UI-Router library version, the behavior is completely different: (watch the browser console)

Using version 0.2.10: JSFiddle ui-router 0.2.10

==> The result is as expected, modifying the URL doesn't do anything.

Using version 0.2.11: JSFiddle ui-router 0.2.11

==> The view controller is reloaded on each $state.go() call

Using version 0.2.12: JSFiddle ui-router 0.2.12

==> The ui-router is simply not found

Using version 0.2.13: JSFiddle ui-router 0.2.13+

==> Starting from the 0.2.13 version the view controller is not reload on each $state.go() call. However, the search view controller is re-instantiated when redirecting to another path.

I am quite confused. Does any ui-router user is aware of those behavior changes. Is the former one as intended to be? Or is this a bug?

Thanks

Upvotes: 1

Views: 260

Answers (1)

Shashank Agrawal
Shashank Agrawal

Reputation: 25797

Yes, they are aware of this behavior changes and is now fully stable at version 0.2.15. This was a bug before but no longer exists starting from 0.2.15 version.

See, all releases.

Upvotes: 1

Related Questions