Tuesday, January 30, 2018

How to write a program for a global API in angularJS.

  • The AngularJS Global API is a set of global JavaScript functions for performing common tasks like:

  1. Comparing objects
  2. Iterating objects
  3. Converting data
  • The Global API functions are accessed using the angular object.
Below is a list of some common API functions:
APIDescription
angular.lowercase()Converts a string to lowercase
angular.uppercase()Converts a string to uppercase
angular.isString()Returns true if the reference is a string
angular.isNumber()Returns true if the reference is a number

Program
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js">
</script>
</head>
<body>
<div ng-app="Abc" ng-controller="DEF">
<p> 
{{x1}}
</p>
<p> 
{{x2}}
</p>
</div>
<script>
var app=angular.module("Abc",[]);
app.controller("DEF",function($scope)
{
$scope.x1="RUSHI";
$scope.x2=angular.lowercase($scope.x1);
});
</script>
</body>

</html>

Output





0 comments:

Post a Comment

Thanks For Commented.

TechTalk