The uppercase Filter in AngularJS is used to change a string to an uppercase string or letters.
Syntax:
{{ string | uppercase}}
Example: This example describes the use of the uppercase Filter in AngularJS.
HTML
<!DOCTYPE html>
< html >
< head >
< title >uppercase Filter</ title >
< script src =
</ script >
</ head >
< body ng-app = "app" style = "text-align:Center" >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h2 >AngularJS uppercase Filter</ h2 >
< div ng-controller = "geek" >
< p >
< span style = "color:green" >
{{msg | uppercase}}
</ span > is the computer
science portal for geeks.
< p >
</ div >
< script >
angular.module('app', [])
.controller('geek',
['$scope', function ($scope) {
$scope.msg = 'GeeksforGeeks';
}]);
</ script >
</ body >
</ html >
|
Output:
Example 2: This example describes the use of the uppercase Filter in AngularJS by transforming the entered text to uppercase.
HTML
<!DOCTYPE html>
< html >
< head >
< script src =
</ script >
< style >
body {
text-align: center;
font-family: arial;
}
h1 {
color: green;
}
</ style >
</ head >
< body >
< h1 >GeeksforGeeks</ h1 >
< h2 >AngularJS uppercase Filter</ h2 >
< div ng-app = "myApp" ng-controller = "myCtrl" >
< strong >Input:</ strong >
< br >
< input type = "text" ng-model = "string" >
< br >
< strong >Output:</ strong >
< br > {{string|uppercase}}
</ div >
< script >
var app = angular.module('myApp', []);
app.controller('myCtrl', function ($scope) {
$scope.string = "";
});
</ script >
</ body >
</ html >
|
Output: