I use Angular2 and UI-Router 2 in no-hash mode for a simple application with some anchor links in the menu. For instance:
If I go from a route with a hash to a URL without it, the hash will remain. For example, going from /blah/blech#specifications to /blah/derp through the menu leads to the browser address /blah/derp#specifications . Obviously, this is incorrect and actually limits somewhat, for example, when I return to /blah/blech and the hash value remains, sending a window to this anchor point.
Another side effect is page refresh in a somewhat unpredictable way. Moving from /blah/derp to /blah/blech#specifications refresh the full page.
The setup is pretty standard:
export let derpState: Ng2StateDeclaration = { name: 'derpState', component: DerpComponent, url: '/derp' }
How to combine hash links with UI-Router 2 with good results? (Alternatively, how can I use anchor links with UI-Router in other ways?)
source share