1

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

So the expected behavior is to reinstanciate the view controller that we are leaving... that doesn't sound very logical to me. jsfiddle.net/limax84/ox0pyx9q/1 If this controller does some heavy REST loading this is a huge waste of resource.

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.