i have tried using ng-disabled in div tag, but it is not working. does ng-disabled will work on div tags? if yes then how?
<div ng-disabled="true">
<button>bbb</button>
</div>
you can use the next directive:
//***********************************// //this directive is ng-disabled directive for all elements and not only for button //***********************************//
app.directive('disabledElement', function () {
return {
restrict: 'A',
scope: {
disabled: '@'
},
link: function (scope, element, attrs) {
scope.$parent.$watch(attrs.disabledElement, function (newVal) {
if (newVal)
$(element).css('pointerEvents', 'none');
else
$(element).css('pointerEvents', 'all');
});
}
}
});
and the html:
<div ng-click="PreviewMobile()" data-disabled-element="toolbar_lock"></div>
there is a number of elements in HTML that takes the 'disabled' attribute in effect, DIV is not one of them.
you can see what elements take that attribute, here
these elements accept the 'disabled' attr:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With