angular - 角度材料表错误:“...MatCellDef 未定义隐式值”
问题描述
在我的应用程序中的所有 Angular Material 表中,每个 td 标签和底部 tr 标签都有一个错误
'MatCellDef' 的模板上下文没有定义隐式值。如果上下文类型是基本类型,请考虑将其细化为更具体的类型。
桌子:
<table mat-table matSort [dataSource]="businessLocations">
<ng-container matColumnDef="business_city">
<th mat-header-cell mat-sort-header *matHeaderCellDef> City </th>
<td mat-cell *matCellDef="let location">{{location.business_city}}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
一些 TS:
this.businessLocations = response.businessLocations;
this.businessLocations = new MatTableDataSource(this.businessLocations);
如果需要,我可以提供更多代码。我正在使用带有 Angular Essentials 插件的 Visual Studio Code。似乎无法找到任何答案
解决方案
推荐阅读
- r - 错误消息 - 被视为 NA 的未替换值不兼容。请详细指定替换或提供 .default
- debugging - 调试会话期间禁用 VS Code 调试器工具栏按钮
- git - .gitignore 即使在删除缓存后也不起作用
- javascript - Repl.it 加载模块脚本失败:需要一个 JavaScript 模块脚本
- vba - 使用 vba for SAP GUI 检索数据集时出错
- javascript - 在javascript中委托值的最合适方法是什么
- python - 使用py2exe将py文件转换为exe时如何修复debugpy语法错误?
- c# - 如何在下面的代码中应用 oops 以减少冗余代码?
- html - Django分页计数不断增加
- r - r regex 删除括号前后的所有字符