Assume that we have a logic like this:
$state.go(stateC)
My question is how to go back to state A from state C (given the fact that state A can be any state we don't know at run-time, meaning user can access state B from any other states)
Use the location option with value "replace"...
$state.go(stateC, null, {
location: 'replace'
})
See https://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#methods_go
location - {boolean=true|string=} - If
truewill update the url in the location bar, iffalsewill not. If string, must be"replace", which will update url and also replace last history record.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With