我正在将以下代码用于HTML:
<input #dp="bsDatepicker" bsDatepicker [bsConfig]="{ dateInputFormat: 'DD-
MMM-YYYY' }" [(ngModel)]="myDate" (ngModelChange)="updateMyDate($event)"
name="myDate" type="text">
myDate: any;
updateMyDate(event) {
today = '07-Oct-2019'
if(new Date(event) > new Date(today)) {
this.myDate = today;
} else {
this.myDate = event;
}
}
如何使用(ngModelChange)在HTML上更新myDate的值?