使用Angular Form Array与Angular Material Table报错:找不到id为position的列
Angular Form Array结合Angular Material Table报错:找不到id为"position"的列
我尝试基于Angular Form Array构建Angular Material Table时,遇到如下报错:
Could not find column with id "position".
我查阅了大量关于matColumnDef指令的解决方案,代码中已经包含该指令,且名称与dataSource一致,示例代码如下:
<ng-container matColumnDef="position"> <th mat-header-cell *matHeaderCellDef> No. </th> <td mat-cell *matCellDef="let element" [formControlName]='arrayOfProperties[0]' > {{element.position}} </td> </ng-container>
我推测问题出在表格的构建方式上,相关代码片段如下:
<div formArrayName="tourTable" *ngFor="let controls of tourTable.controls; let i = index;"> <div [formGroupName]="i">
内容的提问来源于stack exchange,提问作者paulotarcio
相关产品推荐
相关产品推荐

