I have a view that contains an anchor link. That link has an href to another url in my site. Angular tries to load that site, using html5mode. I would rather just have default behavior for that link and send the user off to the url. How can I specify that this particular link should behave like a normal html link, not an angular route?
Method 1: Using HTML: One can use the anchor tag to redirect to a particular section on the same page. You need to add ” id attribute” to the section you want to show and use the same id in href attribute with “#” in the anchor tag.
AngularJS understands a few rules that will make the browser perform a full reload. The rules are documented under the 'Html link rewriting' section in the $location service documentation.
From the documentation:
In cases like the following, links are not rewritten; instead, the browser will perform a full page reload to the original link.
<a href="/ext/link?a=b" target="_self">link</a>
<a href="http://angularjs.org/">link</a>
<a href="/not-my-base/link">link</a>
Note that the last example only works if you have used the base
element in the head section of your page:
<base href="/my-base/" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With