When applying angular syntax {{}}on an element, the directive attrs.$setwill not work.
Edit:
My question is: can anyone explain why ?
If {{}}parsed, then linkwhy the item has not been changed to link?
If linkat first {{}}it should be deleted, both conditions will not look like this.
Here is the code handle
<div ng-app="ngApp" ng-controller="global">
<a aaa href="http://{{::lan}}/4567">has syntax</a>
<a aaa href="http://nosyntax/4567">no syntax</a>
</div>
angular.module('ngApp',[])
.directive('aaa',function(){
return {
link:function(scope, ele, attr){
attr.$set('href','http://fromdirective');
}
}
}).controller('global',function($scope){
$scope.lan = 'en-gb';
})
source
share