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 based on boolean like this
if (tAttributes.drag == 'true') {
tElement.find('.myclass').attr('draggable');
}
But this is not working.
I thing i need to recompile element after adding but i don't know how to do it