Rebel
Rebel

Reputation: 797

How do you link to a specific part of the page in Angular?

To make a typical "Go back to top" link usually you would put, say

<a id="top"></a>
[...]
<a href="#top">Top</a>

In AngularJS this link tries to go to example.com/#top instead, therefore it goes back to the default route. How do you tell angular treat this link appropriately?

Upvotes: 1

Views: 1323

Answers (1)

francisco.preller
francisco.preller

Reputation: 6629

You would use the $anchorScroll service.

http://docs.angularjs.org/api/ng.$anchorScroll

Upvotes: 3

Related Questions