So I wrote a directive that will be applied to link tags like this: <a href="..." replace-link"></a>. What the directive does is check some stuff and then modify/replace/remove the href. It also does some additional stuff, so I do not and can not use ng-href for my purpose.
The directive contains the following code:
myApp.directive('replaceLink', function () {
return {
link: function (scope, element, attrs) {
attrs.$set('href', attrs.href + 'REPLACED!');
}
};
});
but does not seem to work. When changing it to something like
attrs.$set('newhref', attrs.href + 'REPLACED!');
and inspecting the source later, I can see that it worked and the new attribute was set. Why can I not set the "href" attribute?