How to disable a button in ANGULARJS

I make it without derective. I made it like this:

<a href="" id="trash" class="cntrbtn remove pull-left disabled" ng-click="disabled||usertaskctrl.removeTasksToArchive()" ng-disabled="disabled">remove</a>

In controller first of all made

$scope.disabled = true;

Than in if/else remove class disabled and change $scope.disabled = false;

I give you example with tag <a></a> this work with button simple.

And in button ng-click first made Test ng-click="disabled||usertaskctrl.removeTasksToArchive()" before make click on some you function.


The button will be disabled only if the expression is true.

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app ng-init="disableBtn=true">
  <button ng-disabled="disableBtn">test</button>
</div>