Mateo Casasbuenas
Mateo Casasbuenas

Reputation: 51

mat-table can't bind dataSource

I am trying to use angular material table MatTableModule, but when passing the data to the [dataSource] input I am getting the Can't bind to 'dataSource' since it isn't a known property of 'table'. error. I have already imported the MatTableModule and as pointed at GitHub issue #5577 also imported CdkTableModule but still no luck. Any ideas?

Upvotes: 0

Views: 7205

Answers (1)

Mateo Casasbuenas
Mateo Casasbuenas

Reputation: 51

The problem was that the material angular version I'm using is v5.2.4, so the template should be <mat-table #table [dataSource]="dataSource"></mat-table> instead of <table mat-table #table [dataSource]="dataSource"></table> according to Angular material v5.2.4 documentation. https://v5.material.angular.io/components/table/overview#1-write-your-mat-table-and-provide-data

Upvotes: 4

Related Questions