Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add multiple conditions to "ng-disabled"?

I need to check that two conditions are both true before enabling a button:

Here is an example:

<button type="submit" ng-disabled="frmUser.pw2.$error.pwMatch" class="btn btn-primary" ng-click="ChangePassword()">Change</button> 

This example only contains one condition within ng-disabled. How would I add another such as a scope variable?

like image 803
Matt Cashatt Avatar asked Dec 12 '13 22:12

Matt Cashatt


People also ask

How do I give conditions in NG-disabled?

Or you can use ng-disabled="condition1 || condition2" , is depend of you logic conditional.

What does disabled mean in angular?

The ng-disabled Directive in AngularJS is used to enable or disable the HTML elements. If the expression inside the ng-disabled attribute returns true then the form field will be disabled or vice versa. It is usually applied on the form field (i.e, input, select, button, etc).


1 Answers

You should be able to && the conditions:

ng-disabled="condition1 && condition2" 
like image 101
Davin Tryon Avatar answered Oct 29 '22 18:10

Davin Tryon