错误 使用 MatTableExporter 时没有 "exportAs" 设置为 "matTableExporter" 的指令
Error There is no directive with "exportAs" set to "matTableExporter" when using MatTableExporter
来自 docs example 我正在尝试使用垫子 table 导出器,这样:
<ng-container>
<mat-card class="mat-card py-0">
<mat-card-header class="label">
<ng-container>
<mat-card-title>{{titoloTabella}}</mat-card-title>
<button mat-button class="align-right" (click)="changeClass()">
<mat-icon [ngClass]="(rotate)?'rotate':'no-rotate'">keyboard_arrow_down</mat-icon>
</button>
</ng-container>
</mat-card-header>
<table mat-table matSort [dataSource]="dataSource" matTableExporter #exporter="matTableExporter">
<ng-container *ngFor="let header of tableConfiguration.tableHeaders; let i = index" matColumnDef="{{ header.headerId }}">
<th mat-header-cell mat-sort-header *matHeaderCellDef>{{ header.headerName }}</th>
<td mat-cell *matCellDef="let row" > {{ row[header.headerId] }} </td>
<ng-container *ngIf="i == 0 && header.isJoinable == 'no'">
<td mat-footer-cell *matFooterCellDef>TOTALE</td>
</ng-container>
<ng-container *ngIf="i > 0">
<td mat-footer-cell *matFooterCellDef>{{ tableFooter[header.headerId] }}</td>
</ng-container>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="(collapsed)? 'collapsed-rows': 'no-collapsed-rows' "></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns"></tr>
</table>
</mat-card>
<button (click)="exporter.exportTable('xlsx')"> EXPORT</button>
</ng-container>
我已经在 app.module.ts 的供应商部分导入了 MatExporterTabModule。但这是我在 运行 应用程序时遇到的错误:
RROR Error: Uncaught (in promise): Error: Template parse errors: There
is no directive with "exportAs" set to "matTableExporter" ("
您必须在 "imports" 部分而不是提供程序中导入此模块。
来自 docs example 我正在尝试使用垫子 table 导出器,这样:
<ng-container>
<mat-card class="mat-card py-0">
<mat-card-header class="label">
<ng-container>
<mat-card-title>{{titoloTabella}}</mat-card-title>
<button mat-button class="align-right" (click)="changeClass()">
<mat-icon [ngClass]="(rotate)?'rotate':'no-rotate'">keyboard_arrow_down</mat-icon>
</button>
</ng-container>
</mat-card-header>
<table mat-table matSort [dataSource]="dataSource" matTableExporter #exporter="matTableExporter">
<ng-container *ngFor="let header of tableConfiguration.tableHeaders; let i = index" matColumnDef="{{ header.headerId }}">
<th mat-header-cell mat-sort-header *matHeaderCellDef>{{ header.headerName }}</th>
<td mat-cell *matCellDef="let row" > {{ row[header.headerId] }} </td>
<ng-container *ngIf="i == 0 && header.isJoinable == 'no'">
<td mat-footer-cell *matFooterCellDef>TOTALE</td>
</ng-container>
<ng-container *ngIf="i > 0">
<td mat-footer-cell *matFooterCellDef>{{ tableFooter[header.headerId] }}</td>
</ng-container>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;" [ngClass]="(collapsed)? 'collapsed-rows': 'no-collapsed-rows' "></tr>
<tr mat-footer-row *matFooterRowDef="displayedColumns"></tr>
</table>
</mat-card>
<button (click)="exporter.exportTable('xlsx')"> EXPORT</button>
</ng-container>
我已经在 app.module.ts 的供应商部分导入了 MatExporterTabModule。但这是我在 运行 应用程序时遇到的错误:
RROR Error: Uncaught (in promise): Error: Template parse errors: There is no directive with "exportAs" set to "matTableExporter" ("
您必须在 "imports" 部分而不是提供程序中导入此模块。