Reputation: 29
Im loading in a number in chosen.number. it can be all from 1 to 10.
<button name="stop" ng-click="stop()" ng-disabled="true">Stoppa</button>
Now i want it to check if chosen.number is 1 OR 2, it should make the stop button disable to false. Any clues? thank you in advance.
$scope.stop = function (time) {
if (chosen.number == 1 || chosen.number == 2)
$scope.stop.disable = true;
}
Upvotes: 2
Views: 74
Reputation: 726
you can bind variable IsOneOrTwo
to disable property
<button name="stop" ng-click="stop()" ng-disabled="IsOneOrTwo">Stoppa</button>
...
$scope.IsOneOrTwo=false;
$scope.stop = function (time) {
if (chosen.number == 1 ||chosen.number == 2)
$scope.IsOneOrTwo = true;
}
Upvotes: 1