Nibras
Nibras

Reputation: 369

Angular material table not rendering data

Angular material data is not rendering the data even though datasource has correct data to be displayed

Note: Paginator is working correctly according to the datasource

HTML

enter image description here

TS

this.assignmentDataSource = new MatTableDataSource<Assignment>(assignmentList); //assignmentList has data loaded
this.assignmentDataSource.paginator = this.paginator;

Output

enter image description here

Console

console.log(this.assignmentDataSource);

enter image description here

I want to know why the data is not rendering to the view

Thanks !!!

Upvotes: 1

Views: 804

Answers (2)

karine Amaral
karine Amaral

Reputation: 1

Try replacing tag <table></table> for <mat-table></mat-table>.

Upvotes: 0

Anarno
Anarno

Reputation: 1640

There have matColumnDef directives, and this directive try to get the key of an object. But you define a bad key, and the dataTable cant read the objects. Try to add the excepted matColumnDef values.

Upvotes: 1

Related Questions