javascript - Transitioning to state with query parameter -
i'm using angular ui-router manage client side routing. i'm trying use $state.go()
method switch states, want include query parameter in new url, , i'm not sure how to. i've defined target state in app module:
$stateprovider.state('login', { url: '/login?returnurl', //more properties }
and want navigate http://localhost:3000/login?returnurl=%2fhome
.
how format $state.go()
call correctly?
this should work:
$state.go('login', { 'returnurl': '/home' });
or if want call login page http response interceptor on 401:
$state.go('login', { 'returnurl': $state.current.url });
Comments
Post a Comment