Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS: ng-disabled passing more than 1 expression?

Does anyone know if its possible to have ng-disabled use 2 expressions. I would like to disable the buttton when its clicked, this is to stop DOUBLE POSTBACK but i would also like it disabled until the form is valid i.e.

  <button ng-disabled="!myForm.$valid" ...............

But what about double postback.

Is this possible ?

Thanks in advance

like image 649
Martin Avatar asked Jul 11 '13 13:07

Martin


1 Answers

You can do something like:

ng-disabled="condition1 || condition2"

condition1 would be your validation and the contition2 would be when the button has been clicked. Setting either to true will disable the button.

like image 145
petebowden Avatar answered Nov 10 '22 04:11

petebowden