I want to disable particular dates in mat date picker , which comes from database , the problem which i am facing is value of dates which fetching from database taking time , before that DOM gets executed .
Here is HTML code
<mat-form-field class="w-100">
<input matInput [matDatepicker]="picker" formControlName="startDate" [matDatepickerFilter]="myHolidayFilter" placeholder="Choose a date">
<mat-datepicker-toggle matSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker ></mat-datepicker>
</mat-form-field>
and the component.ts file part is
myHolidayFilter = (d: Date)=> {
const time=d.getTime();
return !this.myHolidayDates.find(x=>x.getTime()==time);
}
I written a service call in ngoninit which takes data from database.
this.scheduleService.getLeaveDate().subscribe(result=>{
this.myHolidayDates=result;
});
What can i do , any suggestions . Thanks