错误错误:未捕获(承诺):错误:模板解析错误:由于它不是'mat-table'的已知属性,因此无法绑定到'dataSource'

时间:2019-05-07 06:34:35

标签: angular angular-material

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:

1 个答案:

答案 0 :(得分:0)

尝试更换:

 <mat-table [dataSource]="countryTrafficStats" matSort>
...
</mat-table>

具有:

<table mat-table [dataSource]="countryTrafficStats" matSort>
...
</table>