how can I add extra condition on below code
<div ng-class="{true: 'complete'}[item.Id != 0]"></div>
here I need to add "{true: 'abc'}[item.name == "FName"]
, can anyone help me out.
thank you
how can I add extra condition on below code
<div ng-class="{true: 'complete'}[item.Id != 0]"></div>
here I need to add "{true: 'abc'}[item.name == "FName"]
, can anyone help me out.
thank you
After doing a quick search i found this:
ng-class="{'test': obj.value1 == 'someothervalue' || obj.value2 == 'somethingelse'}"
Source: AngularJS ngClass conditional Credits go to https://stackoverflow.com/users/736482/bertrand
I guess that you want complete
class to be added with this condition: item.Id != 0
. The correct syntax for this is the below:
<div ng-class="{ 'complete': item.Id != 0 }"></div>
You can add as many classes you want using a comma:
<div ng-class="{ 'complete': item.Id != 0, 'abc': item.name == 'FName' }"></div>