angularjs - Adding query string to UI router route -
i have ui router route defined follows
$stateprovider .state('search', { url: '/search', abstract: true, parent: 'loggedin', views: { wrapper: { controller: 'myctrl', controlleras: 'myctrl', templateurl: '/scripts/views/search/views/search.wrapper.html' } } }) .state('search.subs', { url: '', resolve: { isloggedin: isloggedin }, views: { body: { controller: 'searchbodyctrl', controlleras: 'searchbodyctrl', templateurl: '/scripts/views/search/views/search.body.html' } } });
anyways issue cannot generate query parameters url looks /search?hello=world
tried using $state.transitionto('search.subs', {hello: 'world'})
didn't work. figured params passed did not match put in query string not case.
this should want do:
.state('search.subs', { url: '?hello', // appends parent url ....
afterwards can use $state.go('search.subs', { hello : 'world' })
transition search.subs state.
https://github.com/angular-ui/ui-router/wiki/url-routing#query-parameters
Comments
Post a Comment