-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
I have a login state with no URL specified. The idea is when navigating to a given state they will be redirected to the login state if they aren't logged in. The URL shouldn't be updated in this case - it should reflect the intended state. If they login, the state is synced with the url via $urlRouter.sync().
However what is happening is:
redirect to login
transition login Object {
location: "replace",
relative: null,
inherit: true,
notify: false,
current:
custom:
inherit: true
location: "replace"
notify: false
redirectedFrom: Transition
relative: null
reload: false
reloadState: undefined
source: "redirect"
passing through
transition home Object {
location: true,
relative: null,
inherit: true,
notify: true,
current:
custom:
inherit: true
location: true
notify: true
relative: null
reload: false
reloadState: undefined
source: "url"
redirect to login
transition login Object {
location: "replace",
relative: null,
inherit: true,
notify: false,
current:
custom:
inherit: true
location: "replace"
notify: false
redirectedFrom: Transition
relative: null
reload: false
reloadState: undefined
source: "redirect"
passing through
The redirect is using code similar to:
return $state.target('login', [], { custom: { xx: 'asdf'} , notify: false, location: false });
But location is being set to 'replace'. Because the login state doesn't have a URL, it is being set to '/', which modifies the URL, losing the intended url and causing extra state redirects (intended -> login -> / -> login)
(ui router v1.0.0-rc.1, angular 1.6.1)