【发布时间】:2014-12-01 22:23:08
【问题描述】:
所以,我整理了一个非常简单的日期选择器:
HTML:
<div ng-controller="DatepickerCtrl">
<div style="display:inline-block; min-height:290px;">
<datepicker min-date="minDate" show-weeks="false" class="well well-lg" ng-model="dt"> </datepicker>
</div>
<p>Date: {{dt}}.</p>
JavaScript:
angular.module('services', ['ui.bootstrap']);
angular.module('services').controller('DatepickerCtrl', function ($scope) {
$scope.toggleMin = function() {
$scope.minDate = $scope.minDate ? null : new Date();
};
$scope.toggleMin();
});
日期选择器正确加载,但 ng-model 未更新,标记末尾的段落显示“dt”的空白值。
我在 GitHub 上看到了一些类似的问题(https://github.com/angular-ui/bootstrap/issues/808、https://github.com/angular-ui/bootstrap/issues/784),但那里的解决方案都没有解决问题。
有什么想法吗?
【问题讨论】:
标签: javascript angularjs twitter-bootstrap angularjs-directive datepicker