I am building a navigation tree in Angular JS. Most links in the tree will point to pages within my website, but some may point to external sites.
If the href of a l
Update
Or use a directive:
module.directive('myTarget', function () {
return {
restrict: 'A',
link: function(scope, element, attrs) {
var href = element.href;
if(true) { // replace with your condition
element.attr("target", "_blank");
}
}
};
});
Usage:
Link
When you don't need to use this with Angular routing you can simply use this:
Link