JoJo
JoJo

Reputation: 29

Button disable from false to true

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

Answers (1)

Kostia Mololkin
Kostia Mololkin

Reputation: 726

you can bind variable IsOneOrTwo to disable property

html

<button name="stop" ng-click="stop()" ng-disabled="IsOneOrTwo">Stoppa</button>

controller

...
$scope.IsOneOrTwo=false;
$scope.stop = function (time) {
     if (chosen.number == 1 ||chosen.number == 2)
      $scope.IsOneOrTwo = true;
     }

Upvotes: 1

Related Questions