In this tutorial, I will tell you about how to checkout some utility methods that returns BOOLEAN values on call. In AngularJS you can find many utility method like isObject, isString, isDefined, etc to check the type of the input.

All these method has similar signature like isXxxxx(). In the following code, will show you some utility methods that are present inside the angular object.

<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"></script> <meta charset="utf-8">
 <title> How to Checkout Utility Methods on AngularJS? </title>
</head>
<body ng-controller="MyController" ng-cloak>
<h3>angular.isArray : {{isArray}}</h3>
<h3>angular.isDate: {{isDate}}</h3>
<h3>angular.isDefined : {{isDefined}}</h3>
<h3>angular.isElement : {{isElement}}</h3>
<h3>angular.isFunction : {{isFunction}}</h3>
<h3>angular.isNumber : {{isNumber}}</h3>
<h3>angular.isObject : {{isObject}}</h3>
<h3>angular.isString : {{isString}}</h3>
<h3>angular.isUndefined : {{isUndefined}}</h3>

<script>
var myApp = angular.module("myApp", []);
myApp.controller("MyController", ["$scope",
function($scope) {
var fruitList = ["Apple", "Orange"];
$scope.isArray = angular.isArray(fruitList);
$scope.isDate = angular.isDate(new Date());
$scope.isDefined = angular.isDefined(fruitList);
$scope.isElement = angular.isElement("Hello");
$scope.isFunction = angular.isFunction(new Date().getFullYear);
$scope.isNumber = angular.isNumber(5);
$scope.isObject = angular.isObject({});
$scope.isString = angular.isString("Peter");
$scope.isUndefined = angular.isUndefined(null); } ]); </script>
</body>
</html>

And here is the output from the above code:

AngularJS with Free ASP.NET Hosting

Try our AngularJS with Free ASP.NET Hosting today and your account will be setup soon! You can also take advantage of our Windows & ASP.NET Hosting support with Unlimited Domain, Unlimited Bandwidth, Unlimited Disk Space, etc.