Spdexter
Spdexter

Reputation: 933

Angular ng-disabled checking multiple values

I am trying to check multiple values in ng-disabled.

I am trying

ng-disabled = "{{ (id === po.adm_sid) ||  (sid === po.opm_sid) }}"

which doesn't work. It works when I check a single value. I also tried:

ng-disabled = "{{ id === (po.adm_sid ||  po.opm_sid) }}"

Upvotes: 1

Views: 722

Answers (1)

Niles Tanner
Niles Tanner

Reputation: 4041

I would make a helper function and not have multiple checks in the html. Something like:

ng-disabled = "isDisabled()" 

$scope.isDisabled = function(){
   return (id === po.adm_sid) || (sid === po.opm_sid);
}

I usually have better luck with this kind of set up for multiple value checking in the html

Upvotes: 3

Related Questions