Is there a way in a directive to check if an element has a specific attribute before performing a function on it? I couldn't find anything related to this in the jqLite documentation.
For example:
.directive('noReadonly', function() {
return {
link: function($scope, $element, $attr, ctrl) {
$element.on('focus', function() {
if ($element.hasAttribute('readonly'))
$element.removeAttr('readonly');
});
},
}
})