我有一个永远打开的 mat-calendar 控件。在初始加载时,我会突出显示一组日期,这些日期可以执行以下操作:突出显示 mat-calendar 中的某些日期。现在我必须通过单击按钮突出显示今天(或选定的日期)。只有当我更改为不同的月份,然后返回到当前月份的视图时,突出显示才有效。有没有办法动态刷新 mat-calendar?请指教。
我正在尝试使用 *ngFor 在 Mat-accordian 中显示多个 Mat-expansion-panel。我需要点击一个我能够做到的按钮来添加一个新的垫子扩展面板。我还需要在单击按钮时展开(打开)这个新添加的扩展面板,这是我无法实现的。请帮忙。
Stackblitz - https://stackblitz.com/edit/angular-fh5vu1-g6phe6?file=app%2Fexpansion-steps-example.ts
export class ExpansionStepsExample {
items: number[] = [1,2,3];
AddNewRow() {
this.items.push(4);
}
}
Run Code Online (Sandbox Code Playgroud)
<mat-accordion class="example-headers-align">
<mat-expansion-panel *ngFor="let item of items;">
<mat-expansion-panel-header>
<mat-panel-title> {{item}} </mat-panel-title>
</mat-expansion-panel-header>
{{item}}
</mat-expansion-panel>
</mat-accordion>
<button (click)="AddNewRow()" value="Add New"> Add New </button>
Run Code Online (Sandbox Code Playgroud)