JSFiddle - React, Tailwind, and code Playground
by kyleshen
JavaScript
(function () {
var module;
module = angular.module('nullOnDisabled', []);
module.directive('nullOnDisabled', function ($compile) {
return {
require: 'ngModel',
link: function (scope, elm, attrs, ctrl) {
scope.$watch(attrs.ngDisabled, function (disabled) {
if (disabled) {
ctrl.$setViewValue(undefined);
ctrl.$render();
}
});
}
};
});
});