AngularJS | angular.isDate() Function
The angular.isDate() function in AngularJS is used to determine the value of date is valid or not. It returns true if the reference is a date else false.
Syntax:
angular.isDate( value )
Parameters: This function accepts single parameter value which stores the date object.
Return Value: It returns true if the value passed is date else return false.
Example: This example uses angular.isDate() function to determine the value of date is valid or not.
<!DOCTYPE html> < html > < head > < title >angular.isDate() 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.isDate()</ h2 > < div ng-controller = "geek" > < b >Date:</ b > {{ date }} < br >< br > isDate: {{isDate}} </ div > <!-- Script to uses angular.isDate() function --> < script > var app = angular.module("app", []); app.controller('geek', ['$scope', function ($scope) { $scope.date = new Date; $scope.isDate = angular.isDate($scope.date) }]); </ script > </ body > </ html > |
Output: