javascript - How to make proper anchor tags when angular route is active -


i'm trying set anchor tags template, gets modified angular routeand has following url scheme:

main.html#/view/:name 

i tried ignore angular's routing setting target attribute:

 <a target="_self" href="#some_anchor">go anchor</a> 

however, actual link main.html#/some_anchor, , omitting target=_selfdoesn't change anything.
tried change links target actual current url

$location.path() + "/#some_anchor" 

which doesn't work either (no matter if set targetattribute or not), still "page not found" error.

i have make workaround in same situation:

define function in scope:

$scope.scrollto = function (id) {     var old = $location.hash();     $location.hash(id);     $anchorscroll();     $location.hash(old); }; 

and call way:

<a href="" data-ng-click="scrollto('anchor')">scroll anchor</a> 

Comments