AngularJS | API


AngularJS APIs are used for comparing, iterating and converting objects.Basic AngularJS API includes

  • angular.isString()
  • angular.lowercase()
  • angular.uppercase()
  • angular.isNumber()

1. angular.isString()
It is used to check whether an object is a string or not.It returns true if the object is string otherwise false.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!-- Write HTML code here -->
<!DOCTYPE html>
<html>
  <head>
<script src=
</script>
  </head>
  <body>
  
    <div ng-app="gfg" ng-controller="gfgCntrl">
    <p>{{ object }}</p>
    <p>{{ apiRes }}</p>
    </div>
  
    <script>
      var app = angular.module('gfg', []);
      app.controller('gfgCntrl', function($scope) {
          $scope.object = "GeeksForGeeks";
          $scope.apiRes = angular.isString($scope.object);
      });
    </script>
  
  </body>
</html>

chevron_right


Output:



2. angular.lowercase()
It is used to convert all the characters of the string into lowercase characters.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!-- Write HTML code here -->
<!DOCTYPE html>
<html>
  <head>
<script src=
</script>
  </head>
  <body>
  
    <div ng-app="gfg" ng-controller="gfgCntrl">
    <p>{{ object }}</p>
    <p>{{ apiRes }}</p>
    </div>
  
    <script>
      var app = angular.module('gfg', []);
      app.controller('gfgCntrl', function($scope) {
          $scope.object = "GeeksForGeeks";
          $scope.apiRes = angular.lowercase($scope.object);
      });
    </script>
  
  </body>
</html>

chevron_right


Output:

3. angular.uppercase()
It is used to convert all the characters of the string into uppercase characters.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!-- Write HTML code here -->
<!DOCTYPE html>
<html>
  <head>
<script src=
</script>
  </head>
  <body>
  
    <div ng-app="gfg" ng-controller="gfgCntrl">
    <p>{{ object }}</p>
    <p>{{ apiRes }}</p>
    </div>
  
    <script>
      var app = angular.module('gfg', []);
      app.controller('gfgCntrl', function($scope) {
          $scope.object = "GeeksForGeeks";
          $scope.apiRes = angular.uppercase($scope.object);
      });
    </script>
  
  </body>
</html>

chevron_right


Output:

4. angular.isNumber()
It is used to check whether an object is a number or not. It returns true if object is a number otherwise false.
Example:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!-- Write HTML code here -->
<!DOCTYPE html>
<html>
  <head>
<script src=
</script>
  </head>
  <body>
  
    <div ng-app="gfg" ng-controller="gfgCntrl">
    <p>{{ object }}</p>
    <p>{{ apiRes }}</p>
    </div>
  
    <script>
      var app = angular.module('gfg', []);
      app.controller('gfgCntrl', function($scope) {
          $scope.object = "GeeksForGeeks";
          $scope.apiRes = angular.isNumber($scope.object);
      });
    </script>
  
  </body>
</html>

chevron_right


Output:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

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.