user3737396 user3737396 - 1 year ago 93
AngularJS Question

using default browser behaviour for href and target in an <a> tag in angular2

In angular2, how do you implement the behavior of a simple

<a href="some url" target="_whatever">

without the routing module highjacking the url with the base href?

For example, expected behaviour for the following snippet in an angular template would be to open google in a new tab.

<a href="" target="_blank">

What actually happens is angular compiles the template as follows.

<a _ngcontent-kju-6="" target="_blank" ng-reflect-href="" href="">

Clicking on this opens [the base url]/ a new tab rather than simply

Answer Source

Prefixing your url with a protocol should give you what you want, e.g. ''.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download