JSFiddle - React, Tailwind, and code Playground
by Shubhangi
HTML
<div ng-app="app">
<div ng-controller="Ctrl">
<button ng-click="toggleDisable()">Click to Toggle</button>
<my-tag is-disabled="isDisabled"></my-tag>
<div>Disabled ::: {{isDisabled}}</div>
</div>
</div>
JavaScript
var app = angular.module('app', [])
.controller('Ctrl', function($scope) {
$scope.isDisabled = false;
$scope.toggleDisable = function() {
$scope.isDisabled = !$scope.isDisabled;
};
})
.directive( 'myTag', function() {
return {
restrict: 'E',
scope: {
isDisabled: '&'
},
template: '<select ng-disabled="isDisabled()"><option>not disabled</option></select>',
};
});