Angularjs Examples

AJS Examples


AngularJS Uppercase Function

Sometimes you may require to compare two string or variable value with constant string. It is always recomended that before comparing string, its case should be same. AngularJS provides built in angular.uppercase() function to convert text or string in upper case, which makes easy to compare two string.

It might be also possible that there are requirment to display text in lower case. In order to compair two string or display text in lower case AngularJS provides built in uppercase function which makes easy to compare two string.

Syntax

angular.uppercase(str);

AngularJS Uppercase Function Example

<!DOCTYPE html>
<html ng-app="">  
<head>  <!-- www.techstrikers.com -->
<title>My first AngularJS code</title>  
<script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js">  
</script>  
  
</head>  
<body bgcolor="#bnde45">
<fieldset>
<legend>AngularJS Uppercase Function</legend>
<script>  
var str = "www.techstrikers.com";  
document.write(angular.uppercase(str) + "</br>");  
var name = "JIMI";  
  
if(angular.uppercase(name) == "JIMI")  
    document.write("String are Equal");  
else  
    document.write("Not Equal");  
  
</script>
</fieldset>
</body>  
</html>
See Live Example