Forcing a Link to Behave Normally – AngularJS

Hey everyone,

Another quick post. Working with AngularJS this morning I had a need for a link to redirect to a login page that was not contained within the “angular” part of the app. Unfortunately Angular was overriding the behavior and trying to route it.

The solution is fairly easy for this, simply add a target attribute:

<!-- Original -->
<a href='/account/login' alt='Sign In'>Sign In</a>
<!-- Solution -->
<a href='/account/login' alt='Sign In' target="_self">Sign In</a>

There are a few other solutions depending on your use case, check out the following StackOverflow post for more info:

Leave a Reply