Introduction
AngularJS has many built-in directives that are used to determine the reference. In this article we will discuss about determinate functions. AngularJS has the following directives to be used to determine the reference.
isArray
It determines whether passed reference is an array type or not. It returns true if value is array type.
Syntax
angular.isArray(value);
Example
- $scope.test = angular.isArray(null); //This return false
- $scope.test = angular.isArray({}); //This return false
- $scope.test = angular.isArray([1, 2, 3, 4, 5, 6]); //This return true
- $scope.test = angular.isArray(["J", "I", "G"]); //This return true
It determines whether passed value is a date type or not. It returns true if value is date type.
Syntax
angular.isDate(value);
Example
- var d = new Date('12/14/2015');
- angular.isDate(d); //This return true
- angular.isDate(d.toString());//This return false
It determines whether passed reference is defined or not. It returns true if reference is defined.
Syntax
angular.isDefined(value);
Example
- var p;
- $scope.test = angular.isDefined(p); This return false
- p = 12;
- $scope.test = angular.isDefined(p); This return true
It determines whether passed reference is a DOM element or not. This function returns true if reference is a DOM element.
Syntax
angular.isElement(value);
isFunction
It determines whether passed reference is a function or not. This function returns true if reference is function.
Syntax
angular.isFunction(value);
Example
- $scope.test = angular.isFunction(null); //This return false
- $scope.testFunction = function () { alert('Hi'); }
- $scope.test = angular.isDefined($scope.testFunction); // This return true
It determines whether passed reference is a number or not. This function returns true if reference is number.
Syntax:
angular.isNumber(value);
This function includes all number from +Infinity to -Infinity and special number "NaN".
Example
- $scope.test = angular.isNumber(NaN); // This return true
- $scope.test = angular.isNumber("12"); // This return false
- $scope.test = angular.isNumber(15); // This return true
- $scope.test = angular.isNumber(16.5); // This return true
It determines whether passed reference is an object or not. This function returns true if reference is an object. The "null" is not considered as object.
Syntax
angular.isObject(value);
Example
- $scope.test = angular.isObject(null); // This return false
- $scope.test = angular.isObject(12); // This return false
- $scope.test = angular.isObject({}); // This return true
- $scope.test = angular.isObject({ l: 12 });// This return true
It determines whether passed reference is a string or not. This function returns true if reference is a string type.
Syntax
angular.isString(value);
Example
- $scope.test = angular.isString(null); // This return false
- $scope.test = angular.isString(12); // This return false
- $scope.test = angular.isString("12"); // This return true
- $scope.test = angular.isString("Test");// This return true
It determines whether passed reference is undefined. This function returns true if reference is undefined.
Syntax
angular.isUndefined(value);
Summary
This article is for helping us to learn various Determinate function in AngularJS.

Banketeshvar NarayanPosted Dec 15, 2015, 12:46 AM
Nice Share
Muhammad Aqib ShehzadPosted Dec 14, 2015, 2:24 PM
nice list of pretty useful functions