javascript - Changing URL without reloading in AngularJS -


i got function changes url on button click.

problem:

angularjs reloads on url change automatically.

var newurl = ($state.current.url).replace('{navigationid}', $stateparams.navigationid).replace('{tabid}', tab.statereference); history.pushstate('', tab.statereference, newurl); 

how can change url without reloading page in angularjs?

edit:

i tried use reloadonsearch: false described here: https://docs.angularjs.org/api/ngroute/provider/$routeprovider - still reloads page.

you should have $state each & every state want navigate. can $state.go particular state

$state.go('tostate'); 

if want pass parameters $state, should pass them on $state.go

$state.go('view', { 'index': 123, 'anotherkey': 'this test' }); 

make sure $state ready accept parameters on params

.state('full', {             url: '/full',             templateurl: 'js/content/templates/fullreadview.html',             params: { opmlfeed:null, source:null },             controller: 'fullreadctrl'         }) 

more read on wiki


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -