Angularjs adds a slash to anchor links

How to prevent angularjs from adding slash to anchor links?

Ex. http://examples.com/examples#example1

will turn into http://examples.com/examples#/example1

as soon as the page loads.

Notice the slash (/) after the # character.

Then a later link disables the binding function in html.

+5
source share
1 answer

There is only one hack without adding directives for this purpose:

<a href="#scroll#example1">Scroll to first Example</a> 

The first hash tag will receive an unwanted slash, but the second will work as the default anchor link. The header (in this case "scrolling") of the first hash tag has no effect on this function. This is just semantics. Feel free to invest whatever you want.

-1
source

Source: https://habr.com/ru/post/1205448/


All Articles