javascript - get angular ui router $location.search() to use Basic URL Parameters -


i have ui-router set follows

.state('root.event', {     url : '/event/:id',     templateurl : 'templates/event.html' }) 

(the controller initiated in template)

which gives nice looking basic url parameters like:
www.mysite.com/event/1234

when user navigates directly www.mysite.com/event path (ie param missing) template controller looks recent id parameter either:
- js variable stored in value
- localstorage / cookie etc

i return state using $location.search('id', 1234)

...however, results in urls have query url parameters like:
www.mysite.com/event/?id=1234

is there technique ensure $stateparams updates present url in basic format on update ?

...or possible url parameter & update $state before state change ?
(i looked @ resolve seems passing parameters controllers)

i've had here, here , here - of questions relate how avoid reload on update of $state params

$location.search that. adds query url parameter. think you're looking

$state.go('root.event', {id: 1234}) 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -