Angular7 - Can't bind to 'dataSource' since it isn't a known property of 'mat-table'

后端 未结 3 499
无人共我
无人共我 2021-01-12 11:47

I am using Angular 7.0.2, and I am facing this error while trying to create a table using Angular Material

Can\'t bind to \'dataSource\' since it isn\

3条回答
  •  有刺的猬
    2021-01-12 12:50

    You should import MatTableModule in AppModule or in the Module where you component is declared.

    @NgModule({
      imports: [
        MatTableModule
        ...
      ]
    })
    public class AppModule
    

    or

    @NgModule({
      imports: [
        MatTableModule
        ...
      ],
      declarations : [ProductionOrderComponent]
    })
    public class MyModule
    

提交回复
热议问题