Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 251
guyja Avatar asked Dec 01 '25 08:12

guyja


2 Answers

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.

like image 142
Bricktop Avatar answered Dec 03 '25 23:12

Bricktop


If you want to combine ui-router with anchor tag, I solved my problem using this code

<a ui-sref="routename({'#': 'ownerfeatures'})">Link</a> 
like image 25
Nicolas Law-Dune Avatar answered Dec 03 '25 23:12

Nicolas Law-Dune



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!