Angularjs ui-router - pass extras 'unplanned' parameters -
i have simple state :
.state('search', { url: '/search', templateurl: 'views/search.html', controller: 'search' })
and pass unplanned parameters controller when using search
state or /search
route :
ui-sref="search({foo:1, bar:2})" // call '#/search?foo=1&bar2', // match state , pass foo , bar controller (through $stateparams)
when try this, matches otherwise of router instead. :(
i've read lot of solutions imply declare each parameter in state:
.state('search', { url: '/search?param1¶m2¶m3?...', })
but cannot far parameters list not defined , changes time depending on searched content.
is there way achieve ? or wrong somewhere ?
thx.
edit : when try call directly url : #/search?foo=1
, state search
matches foo
parameter never goes $stateparams empty. don't know how in.
.state('search', { params: ['param1','param2','param3'], templateurl: '...', controller: '...' }); ui-sref="search({param1:1, param2:2})"
credit goes parameters states without urls in ui-router angularjs
Comments
Post a Comment