bing
Flat 10% & upto 50% off + Free additional Courses. Hurry up!

AngularJS API

 

API stands for application programming language. Global API in AngularJS is a set of global JavaScript functions for performing common tasks like:

  • Comparing objects
  • Iterating objects
  • Converting data

Some API functions in AngularJS are as follows:

1. angular.lowercase – Converts the string in lowercase.

 Syntax

angular.lowercase(string);

Example

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="intellipaatApp" ng-controller="intellipaatCtrl">

<p>{{"Before Conversion: " +i1 }}</p>

<p>{{"After Conversion: " + i2 }}</p>

</div>

<script>

var app = angular.module('intellipaatApp', []);

app.controller('intellipaatCtrl', function($scope) {

$scope.i1 = "Intellipaat";

$scope.i2 = angular.lowercase($scope.i1);  // convert string into lowercase

});

</script>

</body>

</html>

Output

Before Conversion: Intellipaat

After Conversion: intellipaat

 

2. angular.uppercase – Converts the string in uppercase.

Syntax

angular.uppercase(string);

Example

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="intellipaatApp" ng-controller="intellipaatCtrl">

<p>{{"Before Conversion: " +i1 }}</p>

<p>{{"After Conversion: " + i2 }}</p>

</div>

<script>

var app = angular.module('intellipaatApp', []);

app.controller('intellipaatCtrl', function($scope) {

$scope.i1 = "Intellipaat";

$scope.i2 = angular.uppercase($scope.i1);  // convert string into lowercase

});

</script>

</body>

</html>

Output

Before Conversion: Intellipaat

After Conversion: INTELLIPAAT

 

3. angular.isNumber() – It checks that the given value is number or not. If value is number then it returns true otherwise returns false.

Syntax

angular.isNumber(value);

Example

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="intellipaatApp" ng-controller="intellipaatCtrl">

<p>{{"Value is: " +i1 }}</p>

<p>{{"Value is number: " + i2 }}</p>

</div>

<script>

var app = angular.module('intellipaatApp', []);

app.controller('intellipaatCtrl', function($scope) {

$scope.i1 = 22;

$scope.i2 = angular.isNumber($scope.i1);  // convert string into lowercase

});

</script>

</body>

</html>

Output

Value is: 22

Value is number: true

 

4. angular.isString() – It checks that the given value is string or not. If value is string then it returns true otherwise returns false.

Syntax

angular.isString(value);

Example

<!DOCTYPE html>

<html>

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>

<body>

<div ng-app="intellipaatApp" ng-controller="intellipaatCtrl">

<p>{{"Value is: " +i1 }}</p>

<p>{{"Value is String: " + i2 }}</p>

</div>

<script>

var app = angular.module('intellipaatApp', []);

app.controller('intellipaatCtrl', function($scope) {

$scope.i1 = 22;

$scope.i2 = angular.isString($scope.i1);  // convert string into lowercase

});

</script>

</body>

</html>

 Output

Value is: 22

Value is String: false

Some more API is:

  • isDate – Determines if a value is a date.
  • isArray – Determines if a reference is anArray.
  • isFunction – Determines if a reference is aFunction.
  • isObject – Determines if a reference is aobject etc.

"0 Responses on AngularJS API"

Training in Cities

Bangalore, Hyderabad, Chennai, Delhi, Kolkata, UK, London, Chicago, San Francisco, Dallas, Washington, New York, Orlando, Boston

100% Secure Payments. All major credit & debit cards accepted Or Pay by Paypal.

top

Sales Offer

  • To avail this offer, enroll before 04th December 2016.
  • This offer cannot be combined with any other offer.
  • This offer is valid on selected courses only.
  • Please use coupon codes mentioned below to avail the offer
offer-june

Sign Up or Login to view the Free AngularJS API.