AngularJS Tutorial - Bind to input date








The following code shows how to Bind to input date.

Example


<!DOCTYPE html>
<html  ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
</head><!--from   w ww . j a  va2 s .c  om-->

<body>
  <div ng-app="miniapp">
    <div ng-controller="Ctrl">
        <label class="control-label" for="inputStart">Start Date:</label>
        <input type="date" id="inputStart" data-ng-model="startDate" /><br />
        <span>{{ startDate | date:'fullDate' }}</span><br />
        <span>{{ startDate }}</span>
    </div>
</div>
<script type='text/javascript'>
var $scope;
var app = angular.module('miniapp', []);
function Ctrl($scope) {
    $scope.form = {}
}
</script>
</body>
</html>

The code above is rendered as follows: