如果ng-model仅为年份,则AngularJs Datapicker ng-model值无法正确绑定。
Selected date is: {{today}}
答案 0 :(得分:0)
angular.module('ui.bootstrap.demo',['ui.bootstrap']).controller('DatepickerDemoCtrl', function ($scope, $filter) {
$scope.today = '2010';
$scope.minDate = new Date();
$scope.open = function() {
$scope.opened = true;
};
//$scope.dateOptions = {
// startingDay: 0
//};
})
.constant('datepickerPopupConfig',{ datepickerPopup:“MMM d,yyyy”, closeOnDateSelection:true, appendToBody:false, showButtonBar:false })
.constant('datepickerConfig',{ formatDay:'dd', formatMonth:'MMMM', formatYear:'yyyy', formatDayHeader:'EEE', formatDayTitle:'MMMM yyyy', formatMonthTitle:'yyyy', datepickerMode:'day', minMode:'day', maxMode:'年', showWeeks:false, startingDay:0, yearRange:20, minDate:null, maxDate:null });