angular-anchor
All external links open in a new tab. This module acts on every a element, watching for href changes. If the anchor has an external host, the target is set to _blank.
There are a few advantages to this approach.
-
No need to remember
target="_blank"for every external link. -
It works on links rendered dynamically with
ng-bind-html.
Install
Install the package.
$ bower install --save angular-anchorInclude the script in your build system.
bower_components/angular-anchor/angular-anchor.jsAdd the module as a dependency.
angular.module('myApp', [ 'ngAnchor' ])MIT License.