musdy
musdy

Reputation: 541

Angularjs UI-Router Change URL without rendering

Does anyone know how to change the url in Angular UI-Router without rendering or changing the state?

Upvotes: 8

Views: 2034

Answers (1)

posixpascal
posixpascal

Reputation: 3140

You can change the URL without changing the state by using:

$location.path("your/path/123").replace()

Or:

$state.go("my.state", {location: true, notify: false, reload: false})

Source: https://github.com/angular-ui/ui-router/issues/64 (last few answers)

General: After creating the model and receiving the id, store it in local storage. Then if user visits later or reloads, just check which id he edited last and change the state. You can offer the user to start from scratch by just deleting the local Storage key and reload.

Upvotes: 8

Related Questions