How do I replace an Angular attribute that already has a value in it? For example:
angular.module('app', [])
.directive('edit', function(){
return {
template: '<a ng-href="{{data}}">Link Text</a>',
replace: true,
link: function(scope, elm, attr){
scope.data = 'http://www.example.com';
}
};
});
HTML:
<a edit ng-href="test"></a>
That just appends the link url to the "test" href. I tried using
elm.attr('ng-href', '{{data}}');
and many variations on that idea, but it didn't work.