我有一个类似
的ngFo循环<mat-option *ngFor="let checklist of filterChecklist | async" [value]="checklist.checklistName" (click)="filterList(checklist.checklistName)">
<span>{{ checklist.checklistName }}</span>
</mat-option>
我想在顶部添加一个项目,例如“全部”或“选择”
我在.ts中的代码是
filterChecklist: any;
this.filterChecklist = this.dataSharingService.filters();
retusn观测以上
我该怎么做, 请给我建议。
谢谢
答案 0 :(得分:1)
也许我不了解您的需求,但
只需在您的ngFO这样之前添加<mat-option>ALL</mat-option>
?
<mat-option>ALL</mat-option>
<mat-option *ngFor="let checklist of filterChecklist | async" [value]="checklist.checklistName" (click)="filterList(checklist.checklistName)">
<span>{{ checklist.checklistName }}</span>
</mat-option>