angular - 错误错误:未捕获(承诺):错误:模板解析错误:无法绑定到“数据源”,因为它不是“垫表”的已知属性
问题描述
core.js:15724 ERROR Error: Uncaught (in promise): Error: Template parse errors:
Can't bind to 'dataSource' since it isn't a known property of 'mat-table'.
1. If 'mat-table' is an Angular component and it has 'dataSource' input, then verify that it is part of this module.
2. If 'mat-table' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
[@animate]="{ value: '*', params: { scale: '.9', delay: '300ms' } }"
>
<mat-table [ERROR ->][dataSource]="countryTrafficStats" matSort>
<ng-container matColumnDef="country">
<"): ng:///OthersModule/AppBlankComponent.html@32:17
'mat-header-cell' is not a known element:
解决方案
尝试更换:
<mat-table [dataSource]="countryTrafficStats" matSort>
...
</mat-table>
和:
<table mat-table [dataSource]="countryTrafficStats" matSort>
...
</table>
推荐阅读
- c++ - 模板函数替换仅在一个参数中未使用 std::function 时才有效
- java - Java - 如果我有一个对象是另一个对象的对象数组,我仍然可以将它用作数组吗
- python - 分块解析大型 json 响应
- mysql - MySQL远程连接时如何确定客户端的主机?
- idris - Idris 不会在指数定律的证明中扩展“mult”
- python - 如何使用生产数据在 Django 中运行测试(只读)?
- javascript - 如何提高这个 Javascript/Cracking code 算法的性能?
- gradle - 在创建 IntelliJ 项目时使用 Gradle 包装器是否有任何缺点?
- webpack - Aurelia:错误:尝试在已存在同名元素时注册元素。姓名:n. - 仅在生产 webpack 构建中出现
- json - 将嵌套的 CSV 数据文件转换为 JSON