The angular.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.
Syntax:
angular.uppercase(string)
Example: This example illustrates the angular.uppercase() Function by specifying the string is converted into uppercase.
HTML
<!DOCTYPE html>
< html >
< head >
< script src =
</ script >
< title >angular.uppercase()</ title >
</ head >
< body style = "text-align:center"
ng-app = "app" >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h2 >angular.uppercase()</ h2 >
< div ng-controller = "geek" >
< br >
< b >Before: </ b >{{ string1 }}
< br >
< button id = "myButton"
ng-mousedown = "upper()" >
Click it!
</ button >
< br >
< b >After: </ b >{{ string2 }}
</ div >
< script >
var app = angular.module('app', []);
app.controller('geek', function($scope) {
$scope.obj1 =
"geeksforgeeks is the computer science portal for geeks."
$scope.obj2;
$scope.string1 = $scope.obj1;
$scope.upper = function() {
$scope.string2 = angular.uppercase($scope.obj1);
}
});
</ script >
</ body >
</ html >
|
Output:
Example: This is another example illustrating the angular.uppercase() Function in Angular JS.
HTML
<!DOCTYPE html>
< html >
< head >
< script src =
</ script >
< title >angular.uppercase()</ title >
</ head >
< body style = "text-align:center"
ng-app = "app" >
< h1 style = "color:green" >
GeeksforGeeks
</ h1 >
< h2 >angular.uppercase()</ h2 >
< div ng-controller = "geek" >
< br > {{ string1 }}
< input type = "checkbox"
ng-mousedown = "upper()" > Click Me
< br > {{ string2 }}
</ div >
< script >
var app = angular.module('app', []);
app.controller('geek', function($scope) {
$scope.obj1 = "geeksforgeeks - learning together!"
$scope.obj2;
$scope.string1 = $scope.obj1;
$scope.upper = function() {
$scope.string2 = angular.uppercase($scope.obj1);
}
});
</ script >
</ body >
</ html >
|
Output:
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
12 Sep, 2022
Like Article
Save Article