Class DateExample {
public start_date = null;
public end_date = null;
constructor() {}
log1(start) {
console.log(start);
}
log2(end) {
console.log(end);
}
ngOninit() {
public start_date = new Date().getTime();
public end_date = new Date().getTime();
}
}
<div class="form-group row">
<div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
<label for="start_date">Start Date</label>
</div>
<div class="col-lg-10 col-md-6 col-sm-12 col-xs-12 date">
<my-date-picker id="start_date" log1(start_date) placeholder="Active From" ngModel #start_date="ngModel" (change)="log(start_date)" name="start_date" [options]="myDatePickerOptions"></my-date-picker>
</div>
</div>
<div class="form-group row">
<div class="col-lg-2 col-md-6 col-sm-12 col-xs-12">
<label for="end_date">End Date</label>
</div>
<div class="col-lg-10 col-md-6 col-sm-12 col-xs-12 date">
<my-date-picker id="end_date" log2(end_date) placeholder="Active Until" ngModel #end_date="ngModel" name="end_date" [options]="myDatePickerOptions"></my-date-picker>
</div>
</div>
所有即时消息都是当前日期,而不是我从日期选择器中选择的特定日期