Not able to add attribute in directive in angular
问题 I have this code in my directive compile: function compile (tElement, tAttributes, transcludeFn) { if (tAttributes.drag == 'false') { tElement.find('.myclass').removeAttr('draggable'); } //attrs.$set('ngModel', 'new value'); return { pre: function preLink (scope, element, attributes, controller, transcludeFn) { // Pre-link code goes here }, post: function postLink (scope, element, attributes, controller, transcludeFn) { This works fine But i want to add attribute instead of remove attribute