AngularJS Tutorial - Bind date value to date input








The following code shows how to Bind date value to date input.

Example


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"></script>
<script type='text/javascript'>
function MyCtrl($scope) {<!-- w  w  w. j  a v  a2  s.  c  o m-->
    $scope.dateVal = new Date(2013, 06,07);
}
</script>
</head>
<body>
  <div ng-controller="MyCtrl" ng-app>
     <input type="date" ng-model="dateVal" />
        <hr/>
    {{dateVal}}  </br>
</div>
</body>
</html>

The code above is rendered as follows: