AngularJS | angular.isUndefined() Function
The angular.isUndefined() function in AngularJS is used to determine the value inside isUndefined function is undefined or not. It returns true if the reference is undefined otherwise returns false.
Syntax:
angular.isUndefined( value )
Return Value: It returns true if the value passed is undefined else returns false.
Example: This example uses angular.isUndefined() function to determine the value inside isUndefined function is undefined or not.
<!DOCTYPE html> <html> <head> <title>angular.isUndefined() function</title> <script src= "//ajax.googleapis.com/ajax/libs/angularjs/1.3.2/angular.min.js"> </script> </head> <body ng-app="app" style="text-align:center"> <h1 style="color:green">GeeksforGeeks</h1> <h2>angular.isUndefined()</h2> <div ng-controller="isDefinedController"> <b>Date:</b> {{date}}<br><br> {{isUndefined}} <br><br><br> <b>Date1:</b> {{date1}}<br><br> {{isUndefined1}} </div> <!-- Script to uses angular.isUndefined() function --> <script> var app = angular.module("app", []); app.controller('isDefinedController', ['$scope', function ($scope) { $scope.date = new Date; $scope.date1; $scope.isUndefined = angular.isUndefined($scope.date) == true ? "$scope.date is Undefined." : "$scope.date is not Undefined."; $scope.isUndefined1 = angular.isUndefined($scope.date1) == true ? "$scope.date1 is Undefined." : "$scope.date1 is not Undefined."; }]); </script> </body> </html> |
Output:

Recommended Posts:
- AngularJS | angular.uppercase() Function
- AngularJS | angular.isElement() Function
- AngularJS | angular.isObject() Function
- AngularJS | angular.isArray() Function
- AngularJS | angular.equals() Function
- AngularJS | angular.element() Function
- AngularJS | angular.isDefined() Function
- AngularJS | angular.isDate() Function
- AngularJS | angular.toJson() Function
- AngularJS | angular.isNumber() Function
- AngularJS | angular.bind() Function
- AngularJS | angular.bootstrap() Function
- AngularJS | angular.isString() Function
- AngularJS | angular.forEach() Function
- AngularJS | angular.lowercase() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



