angularjs

How to clear ui-router hash on page change?  #angularjs #reactjs

  • Stack Overflow works best with JavaScript enabled
  • Then navigate to another page, say route name: app.another, it will take me to the page, but the # stays.
  • The hash’s are not being used for the paths, they are just for the specific page it goes to.
  • sign up log in tour help
  • Browse other questions tagged angularjs angular-ui-router or ask your own question .

I’m using ui-router 1.0b3 with angular 1.5.x. Also using html5Mode(true). The hash’s are not being used for the paths, they are just for the specific page it goes to.

@ng_real_ninja: How to clear ui-router hash on page change? #angularjs #reactjs

I’m using ui-router 1.0b3 with angular 1.5.x. Also using html5Mode(true). The hash’s are not being used for the paths, they are just for the specific page it goes to.

I want to be able to go to http://example.com/app/page#tab3 route name: app.page

Then navigate to another page, say route name: app.another, it will take me to the page, but the # stays. I don’t want the # state to follow the navigation. Both pages need the same “app” parent. If I go to another it should not go to “http://example.com/app/another#tab3” which is what is is doing.

It did not do this on ui-router 0.3.1

I tried removing the hash during the transition: $transitions.onBefore({exiting: ‘app.**’}, function(trans) { trans.params(“to”)[“#”] = null; $location.hash(“”); });

but that doesn’t work at all.

Help? I think this might be a bug, but I can’t figure out a fix.

angularjs