我在 Angular Datepicker 中检索一些禁用的日期时遇到问题,
当我对日期进行硬编码时,我没有问题,一切正常,
但是当我从我的 web api 后端检索禁用日期时,禁用日期被忽略...
我仍然是编程的菜鸟,我可能错过了一些愚蠢的东西
是关于异步编程还是可观察变量?
组件.html
<input type="text" placeholder="Daterangepicker" class="form-control" bsDaterangepicker
[datesDisabled]="disabledDates">
组件.ts
export class Component implements OnInit {
disabledDates :Date[];
constructor(...) { }
ngOnInit() {
...
this.getUnavaibilities();
}
getUnavaibilities(){
this.homesService.getUnavaibilities(this.Id).subscribe(
reponse => this.UnavailabilitieshandleSuccesfulResponse(reponse));
}
UnavailabilitieshandleSuccesfulResponse(reponse){
this.disabledDates = reponse;
console.log(this.disabledDates) // this working fine !
//output from console.log
// Array(4) [ "2019-09-27T00:00:00", "2019-09-28T00:00:00", "2019-09-
//29T00:00:00", "2019-09-30T00:00:00" ]
}
}