What aboutUpdate
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:
<a href="http://www.google.com" my-target>Link</a>
When you don't need to use this with Angular routing you can simply use this:
<a href="http://www.google.com" target="{{condition ? '_blank' : '_self'}}">Link</a>