icenter user01 icenter user01 - 8 months ago 37
AngularJS Question

How to apply conditional ng-class?

this is my send button which has two options 1 send activation email and second reset password. Now I waana apply reset test class to reset password list item if userstatus is notifiied or added so wanted to add conditional statement. I tried but this one is not working. Pease help.

<div class="active-send-select" pull-left btn-group title="{{::'' | translate}}">
<button class="btn btn-large dropdown-toggle" data-toggle="dropdown" ng-disabled="!actionButtonStatus.SENT">
<i class="fa fa-envelope fa-lg"></i>
<span class="action-button-text">{{::'label.button.send' | translate}}</span>
<i class="icon-chevron-down pull-right" style="margin-top:-20px;"></i>
<ul class="dropdown-menu filter-state">
<li class="abc"><a href="" ng-click="userstatus == 'Complete'||sendActivationNotification()"><span ng-class="{resettest: userstatus == 'Complete'}">{{::'label.dropdown.sendActivation' | translate}}</span></a></li>
<li class="abc">
<a href="" ng-click="userstatus == 'Notified' || onSendPasswordReset()"><span ng-class="{resettest: userstatus == 'Notified' || 'Added'}">{{::'label.dropdown.resetPassword' | translate}}</span></a>


color: darkgray;
cursor: not-allowed;


You can do this with simple class instead of ng-class

<span class="{{userstatus == 'Notified' || 'Added'?'resettest': ' '}}">
{{::'label.dropdown.resetPassword' | translate}}

But i did'nt understand why you are trying to add resettest class two times with different condition