我有一个bootstrap datepicker,我最初设置为今天的日期。 HTML:
<input type="text" class="form-control" datepicker-popup="{{dateFormat}}" ng-model="parent.dateRegarding" is-open="dateOpened" datepicker-options="dateOptions" ng-required="true" ng-click="dateOpened = true" close-text="Close" max-date="parent.dateRegarding" />
angularjs功能:
function activate() {
// format and options for datepicker
$scope.dateFormat = 'yyyy-MM-dd';
$scope.tiemFormat = 'HH:mm';
$scope.dateOptions = { formatYear: 'yy', startingDay: 1 };
// default dates for datepicker
var dateRegarding = new Date();
var timeRegarding = new Date();
$scope.parent = { 'dateRegarding': dateRegarding, 'timeRegarding': timeRegarding};
}
选择器工作正常,但如何在用户更改日期时更新$ scope.parent.dateRegarding?