【发布时间】:2021-12-29 21:49:17
【问题描述】:
我正在尝试使用有角度的材质扩展面板显示一组项目,但它没有显示任何内容。我知道扩展面板使用 ng-content 将内容投影到面板组件中。这是我的模板代码的样子:
<mat-expansion-panel>
<mat-expansion-panel-header>
<mat-panel-title> This is the expansion title </mat-panel-title>
<mat-panel-description>
This is a summary of the content
</mat-panel-description>
</mat-expansion-panel-header>
<div *ngFor="let record of records">
<span class="detail-label">Record ID</span>
<span class="detail-value">{{ record?.id }}</span>
<span class="detail-label">Employee Number</span>
<span class="detail-value">{{ record?.employeeNumber }}</span>
</div>
</mat-expansion-panel>
【问题讨论】:
-
检查 content projection 角度的动态数据
-
@akkonrad 正如我在帖子中所说,mat-expansion-panel 在幕后使用 ng-content 来投影 body 的内容,这是我现在拥有我的 div 数组的地方。跨度>
标签: angular angular-material ngfor angular2-ngcontent