JSFiddle - React, Tailwind, and code Playground

by Andrea Aloi

HTML

<script src="https://code.angularjs.org/1.3.11/angular.min.js"></script>
<body ng-app="myApp" ng-controller="myCtrl">
    <p><input type="checkbox" ng-model="a" /> A</p>
    <p><input type="checkbox" ng-model="b" /> B</p>
    <p>a || b = {{a || b}}</p>
    <button type="button" ng-disabled="a || b">Outside directive</button>
    <div my-dir ng-disabled="a || b"></div>
</body>

JavaScript

console.clear();

angular.module("myApp", [])
.controller("myCtrl", ["$scope", function($scope) {
    $scope.a = true;
    $scope.b = false;
}])
.directive("myDir", [function() {
    return {
        restrict: "A",
        template: '<button type="button" ng-disabled="ngDisabled">Inside directive</button>',
        scope: {
        	ngDisabled: "="
        }
    };
}]);