javascript - angular-ui and datepicker directive error -
i trying following example/demo , keep getting error in chrome console:
error: non-assignable model expression: undefined (directive: datepicker)
i dont 404s during execution.
the code used based on:
http://angular-ui.github.io/bootstrap/#/modal
or
http://plnkr.co/edit/?p=preview
the code in modal template:
<pre>selected date is: <em>{{dt | date:'fulldate' }}</em></pre> <div class="well well-small pull-left" ng-model="dt"> <datepicker min="mindate" show-weeks="showweeks"></datepicker> </div>
the code in modal controller:
$scope.today = function () { $scope.dt = new date(); }; $scope.today(); $scope.showweeks = true; $scope.toggleweeks = function () { $scope.showweeks = !$scope.showweeks; }; $scope.togglemin = function () { $scope.mindate = ($scope.mindate) ? null : new date(); }; $scope.togglemin(); $scope.dateoptions = { 'year-format': "'yy'", 'starting-day': 1 };
the solution define ng-model in datepicker:
<div class="well well-small pull-left" > <datepicker min="mindate" show-weeks="showweeks" ng-model="dt"></datepicker> </div>
Comments
Post a Comment