guyja guyja - 1 month ago 15
AngularJS Question

override angular ui-router for links to page anchors

I have links to anchors on my page (a href="#idea"). ui-router obviously overrides them. Is there a way to use both in harmony? Thank you.

https://gist.github.com/anonymous/2880f2f2c9f91b0b695f#file-gistfile1-txt

Answer

Well you aren't supposed to use it on a href this way, instead you should add it like the following:

<a href="" ng-click="gotoAnchor()">...</a>

You can see an example of this at the bottom of the $anchorScroll API here.