Reputation: 697
I have a html format like this , when sec.newValue is not empty I want it to be displayed bold and if its empty , I want to display as it is. so how can I achieve this using ng-class,i tried giving fontweight : bold but it doesn't work
<label class="message">
<span ng-repeat="sec in error" ng-class="{secNew?!sec.newValue }">{{sec. error}}</span>
</label>
.secNew {
font-weight: bold;
}
Upvotes: 0
Views: 36
Reputation: 73301
You pass an object whose key is the class to add, and the value is the condition which, when true, makes the class to actually be attached
{secNew: sec.newValue}
will apply class secNew
only if sec.newValue
returns something truthy.
Upvotes: 2