我们如何保留ngx引导日期选择器的值,关于ngModel更改,
<input type="text"
placeholder="Daterangepicker"
[value]="date"
class="form-control"
bsDaterangepicker>
在我的ts 中
date = new Date();
不幸的是,我无法从您提供的ts
中获得清晰的想法,但这是一个您可能受益的示例:
HTML:
<input type="text"
class="form-control"
bsDatepicker [bsValue]="bsValue"
[(ngModel)]="student.dateOfBirth"
/>
ts:
show(studentId?: number): void {
this._studentService.getStudentFor(studentId).subscribe(studentResult => {
this.bsValue = moment(this.student.dateOfBirth, 'YYYY-MM-DD').toDate();
this.active = true;
this.modal.show();
});
}