Here is a simple example for disable click in AngularJS,
<body ng-app="ngToggle"> <div ng-controller="AppCtrl"> <button ng-click="disableClick(1)">Disable ng-click</button> </div> </body>
In JS:
angular.module('ngToggle', []) .controller('AppCtrl',['$scope', function($scope){ $scope.flag = 0; $scope.disableClick = function(n) { if (n && n !== $scope.flag) { $scope.flag = n; alert("Clicked!"); } return false; } }]);DEMO
Enjoy!
No comments:
Post a Comment