AngularJS Uppercase Filter with Example

Here we will learn what is angularjs uppercase filter, use of uppercase filter in angularjs and how to covert string or text to uppercase using angularjs uppercase filter with simple example.

AngularJS Uppercase Filter

In angularjs, uppercase filter is used to convert string to uppercase. If we want to convert displaying text or string to uppercase in angularjs application we can achieve this by using uppercase filter.

AngularJS Uppercase Filter Syntax

Following is the syntax of using uppercase filter in angularjs

 

{{string_expression | uppercase}}

 We will see how to use uppercase filter in angularjs application with simple example.

AngularJS Uppercase Filter Example

Following is the example of using angularjs uppercase filter

 

Live Preview

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>

AngularJs uppercase filter Example

</title>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

<script>

var app = angular.module("AngularuppercaseApp", []);

app.controller("uppercasectrl", function ($scope) {

$scope.users = [{

name: "Anil Singh",

age: 30

}, {

name: "suresh dasari",

age: 29

}, {

name: "Rohini Alavala",

age: 29

}, {

name: "praveen kumar",

age: 24

}];

});

</script>

</head>

<body ng-app="AngularuppercaseApp">

<div ng-controller="uppercasectrl">

<ul ng-repeat="user in users  ">

<li>{{user.name | uppercase }}</li>

</ul>

</div>

</body>

</html>

If you observe above code we applied uppercase filter to user.name expression while displaying name it will convert name string into uppercase. Now we will run and see the output

Output of AngularJS Uppercase Filter Example

Following is the result of uppercase filter example in angularjs

 

  • ANIL SINGH
  • SURESH DASARI
  • ROHINI ALAVALA
  • PRAVEEN KUMAR

 This is how we can use uppercase filter in angularjs applications to convert string or text to uppercase.