0

我想在 2 个按钮之间切换:OpenAll 和 CloseAll。

如果它全部打开或关闭,我可以读取 mat-accordion 的布尔值吗?

<div class="row">
    <mat-icon *ngIf="accordion.open()" (click)="accordion.openAll()">open_in_full</mat-icon>
    <mat-icon *ngIf="!accordion" (click)="accordion.closeAll()">close_fullscreen</mat-icon>
</div>
<div class="message-box row" *ngIf="notes.length; else noResult">
    <mat-accordion multi>
        <mat-expansion-panel *ngFor="let note of notes" [expanded]="0">
            <mat-expansion-panel-header>
                <mat-panel-title class="col-6">
                    {{note.title}}
                </mat-panel-title>
                <mat-panel-description class="col-6">
                    {{note.created | date:'dd.MM.yyyy'}}
                </mat-panel-description>
            </mat-expansion-panel-header>
            <p>{{note.note}}</p>
        </mat-expansion-panel>
    </mat-accordion>
4

1 回答 1

0

您可以访问isExpanded属性。

见: https ://material.angular.io/components/expansion/api

于 2020-12-07T15:06:33.293 回答