AngularJS | angular.isString() Function

The angular.isString() function in AngularJS is used to determine the parameter inside isString function is a string or not. It returns true if the reference is a string otherwise returns false.

Syntax:

angular.isString( value )

Return Value: It returns true if the value passed is a string otherwise return false.



Example: This example uses angular.isString() function to determine the parameter inside isString function is a string or not.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
    <head>
        <title>angular.isString() function</title>
          
        <script src=
"//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js">
        </script>
    </head>
  
    <body ng-app="app" style="text-align:center">
        <h1 style="color:green">GeeksforGeeks</h1>
        <h2>angular.isString()</h2>
          
        <div ng-controller="geek">
            <b>Input1: </b
                <span>
                    <code>123</code>
                </span>
            <br>
              
            <b>isString: </b>{{isString1}}<br /><br><br>
            <b>Input2: </b
              
            <code>
                "geeksforgeeks"
            </code>
            <br>
              
            <b>isString:</b> {{isString2}}
        </div>
          
        <!-- Script to use angular.isString() function -->
        <script>
            var app = angular.module("app", []);
            app.controller('geek', ['$scope', function ($scope) {
                var obj1 = 123;
                var obj2 = "geeksforgeeks";
                $scope.isString1 = angular.isString(obj1);
                $scope.isString2 = angular.isString(obj2);
            }]);
        </script>
    </body>
</html>                    

chevron_right


Output:
isString



My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.