Open In App
Related Articles

AngularJS angular.lowercase() Function

Improve
Improve
Improve
Like Article
Like
Save Article
Save
Report issue
Report

The angular.lowercase() Function in AngularJS is used to convert the string into lowercase. It can be used when the user wants to show the text in lowercase instead of uppercase or one wants to compare two strings. 

Syntax:

angular.lowercase(string)

Example 1: This example describes the implementation of the angular.lowercase() Function in AngularJS by specifying the button to transform the string to lowercase.

HTML

<!DOCTYPE html>
<html>
 
<head>
    <script src=
    </script>
    <title>angular.lowercase()</title>
</head>
 
<body ng-app="app" style="text-align:center">
    <h1 style="color:green">GeeksforGeeks</h1>
    <h3>angular.lowercase()</h3>
    <div ng-controller="geek">
        <br>
        <b>Before: </b>{{ string1 }}
        <br><br>
        <button id="myButton"
                ng-mousedown="lower()">Click it!
         </button>
        <br><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.lower = function () {
                $scope.string2 = angular.lowercase($scope.obj1);
            }
        });
    </script>
</body>
</html>

                    

Output:

 

Example 2: This example describes the implementation of the angular.lowercase() Function in AngularJS by specifying the checkbox to transform the text to lowercase.

HTML

<!DOCTYPE html>
<html>
 
<head>
    <script src=
    </script>
    <title>angular.lowercase()</title>
</head>
 
<body ng-app="app" style="text-align:center">
    <h1 style="color:green">GeeksforGeeks</h1>
    <h2>angular.lowercase()</h2>
    <div ng-controller="geek">
        <br>
        {{ string1 }}
        <br><br>
        <input type="checkbox" ng-mousedown="lower()">Click Me
        <br><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.lower = function () {
                $scope.string2 = angular.lowercase($scope.obj1);
            }
        });
    </script>
</body>
</html>

                    

Output:

 



Last Updated : 12 Sep, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments