经过大量搜索后,没有解决方案,因为没有“禁用”属性,并且“ date -filter”解决方案不好,因为我还有另一个日期过滤器,这使管理层变得复杂。
我以此CSS解决方案结束
创建CSS样式来模拟禁用:
等待API调用时添加样式:
<mat-calendar
class="calendar"
[ngClass]="{ 'disabled-calendar': callingAPI }"
[maxDate]="maxDate"
(selectedChange)="dayChange($event)"
[(selected)]="selectedDate"
></mat-calendar>
现在我打电话给API时,日历是不可分割的。
dayChange() {
this.callingAPI = true;
this.myService.getData().pipe(finalize(() => this.callingAPI = false));
}