我正在尝试将内容投影到扩展行中,但到目前为止没有成功。同样的方法在其他任何地方都适用,不确定为什么它不适用mat-table
<!-- Expanded Content Column - The detail row is made up of this one column that spans across all columns -->
<ng-container matColumnDef="expandedDetail">
<td mat-cell *matCellDef="let element" [attr.colspan]="columnsToDisplay.length">
<div class="example-element-detail"
[@detailExpand]="element == expandedElement ? 'expanded' : 'collapsed'">
<div class="example-element-description">
{{element.description}}aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
<span class="example-element-description-attribution"> -- Wikipedia
<ng-container [ngTemplateOutlet]='rowDetail'></ng-container></span>
</div>
</div>
</td>
</ng-container>
在我试过的用法中
<demo-table
[rowDetail]="rowDetailContent "
></demo-table>
<ng-template #rowDetailContent >
This is a passed template
</ng-template>
还有这个
<demo-table
[rowDetail]="details "
></demo-table>
TS
@ViewChild('rowDetailContent') details :TemplateRef<any>;
他们似乎都没有成功。
这里是Stackblitz