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>
uppercase() Function in AngularJS is used to convert the string into uppercase. It can be used when the user wants to show the text in uppercase instead of lowercase. Example: This example illustrates the angular. uppercase() Function by specifying the string is converted into uppercase.
The uppercase Filter in AngularJS is used to change a string to an uppercase string or letters.
The star in ngIf is case sensitive. So make sure you spell this exactly the way they are and it was set to a condition.
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'};
}
demo
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With