Why below one is not working ? I need to convert the IsValue
into uppercase value and then need to check it with the NO
value.How can I do that ?
<td class="red-color" ng-if="item.IsValue | uppercase == 'NO'">{{item.IsValue}}</td>
Make sure the uppercase
filter is applied (using ()
) before comparing the value:
<td class="red-color" ng-if="(item.IsValue | uppercase) == 'NO'">{{item.IsValue}}</td>
Here is a working plunker.
If I understand correctly, you want to check for a value and then display it in uppercase somewhere (?) so this will get you going: the ng-if will just check the value. If it is "test" it will display it as uppercase.
<div ng-controller="MyCtrl">
<p class="red-color" ng-if="item.IsValue == 'test'">{{item.IsValue | uppercase}}</p>
<input ng-model="item.IsValue" type="text">
</div>
js
function MyCtrl($scope) {
$scope.item = {IsValue: 'UpPerCASE'};
}
the string comparison is case sensitive so if what you want is to convert it and then compare, you would string.toUppeCcase() it or use the angular method
AngularJS accepts any word value starting with 'n' or 'N' as false. You don't need to convert uppercase and check the value if your model value varies 'no', 'yes'.
<td class="red-color" ng-if="item.IsValue">{{item.IsValue}}</td>
might simply work in many use cases.