Using ui-date and ng-model should be enough:
<div ng-controller="MyCtrl"> <input ng-model="date" ui-date> </div>
Provided that MyCtrl is defined as follows:
function MyCtrl($scope) { $scope.date= new Date(); }β
Here is jsFiddle: http://jsfiddle.net/MvGFF/2/
What you should know is that ui-date expects the model value to be an instance of Date , maybe you are passing in the value of a string (or another type)?
If your model contains values ββthat are strings, and you still want to use the date picker, you need to add the ui-date-format directive, as in this example:
<input ng-model="date" ui-date ui-date-format>
where the controller is defined as follows:
function MyCtrl($scope) { $scope.date= "2012-12-13T00:00:00-07:00"; }β
Here is jsFiddle: http://jsfiddle.net/d4xz2/1/
source share