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

前端 未结 10 2117
南方客
南方客 2020-12-03 00:32

I am new in angular 5 development. I am trying to develop a data table with angular material using the example provided here: \"https://material.angular.io/components/table/

10条回答
  •  一生所求
    2020-12-03 00:51

    Remember to add MatTableModule in your app.module's imports i.e.

    In Angular 9+

    import { MatTableModule } from '@angular/material/table'  
    
    @NgModule({
      imports: [
        // ...
        MatTableModule
        // ...
      ]
    })
    

    Less than Angular 9

    import { MatTableModule } from '@angular/material'  
    
    @NgModule({
      imports: [
        // ...
        MatTableModule
        // ...
      ]
    })
    

提交回复
热议问题