Ng-Focus-7

 

Ng-Focus-7

 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> </head> <body ng-app="app"> <div ng-controller="ctrlName"> <div class="container"> <h3>Ng-Focus</h3> <input type="date" class="form-control" ng-model="dt" ng-focus="displayDate()" ng-blur="hideDate()" /><br /> </div> </div> <script> var app = angular.module("app", []); app.controller('ctrlName', ['$scope', function ($scope) { $scope.displayDate = function () { $scope.dt = new Date(); }; $scope.hideDate = function () { $scope.dt = null; }; }]); </script> </body> </html>
Output