-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Description
I may be using the params options when configuring a state for an unexpected scenario.
I have a login page defined like this:
$stateProvider.state('login', {
controller: 'LoginCtrl',
templateUrl: '/scripts/core/login.html',
url: '/login',
params: {
goToNextState: null,
goToNextParams: null,
reason: null
}
});I used params because I want to pass information to the login page (like why someone would end up being redirected to that page and where to go next once successfully logged in) without "polluting" the URL.
If an auth error happen I used the following code:
$rootScope.$on('$stateChangeError', function (event, toState, toParams, fromState, fromParams, error) {
if (error.type === 'auth') {
$state.go('login', {
goToNextState: toState.name,
goToNextParams: toParams,
reason: 'Auth error yadda yadda'
});
}
// ...
}With ui-router 0.2.12 I see two issues:
- The params appears in the URL as query strings, I was expecting them to be invisible. Can I "fix" that?
- In
LoginCtrl,$stateParams.toParamsequals the string "[object Object]" instead of being thetoParamsobject from before. Is that an expected behavior or a bug?