Global API

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

The Global API functions are accessed using the angular object.
Below is a list of some common API functions:


API

Description

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

angular.lowercase()

Example

 

<html>
<script src="angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">
<p>{{ x1 }}</p>
<p>{{ x2 }}</p>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.x1 = "VISIONCOMPUTERS";
$scope.x2 = angular.lowercase($scope.x1);
});
</script>

</body>
</html>

angular.uppercase()

Example

<!DOCTYPE html>
<html>
<script src="angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">
<p>{{ x1 }}</p>
<p>{{ x2 }}</p>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.x1 = "Visioncomputers";
$scope.x2 = angular.uppercase($scope.x1);
});
</script>

</body>
</html>

angular.isString()

<!DOCTYPE html>
<html>
<script src="angular.min.js"></script>
<body>

<div ng-app="myApp" ng-controller="myCtrl">
<p>{{ x1 }}</p>
<p>{{ x2 }}</p>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.x1 = "VISIONCOMPUTERS";
$scope.x2 = angular.isString($scope.x1);
});
</script>

</body>
</html>

angular.isNumber()

<html>
<script src="angular.min.js"></script>

<body>

<div ng-app="myApp" ng-controller="myCtrl">
<p>{{ x1 }}</p>
<p>{{ x2 }}</p>
</div>

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.x1 = "VISIONCOMPUTERS";
$scope.x2 = angular.isNumber($scope.x1);
});
</script>

</body>
</html>

 

For
More Explanation
&
Online Classes

Contact Us:
+919885348743