angular 5 material MatTableDataSource

Viewed 7441

I updated from angular 4.4.6 and material beta 19 to angular 5 and material 5.0.0-rc0

The application compiles correctly, but executing on Chrome I get

"Uncaught Error: Unexpected value 'MatTable DataSource' imported by the module 'Material Modules'. Please add a @NgModule annotation."

Other material components work correctly, mat-icon, mat-card-content, mat-tab-group, mat-dialog-xxx ...

Could you help me?

4 Answers

Import the module and enter it in your @NgModule Imports section. This is probably in your something.module.ts.

I had similar issue after upgrading to Angular 5, updating all the dependency like typescript, corejs , angular-cli etc to latest version solved the problem.

MatTableDataSource is in the master branch but it isn't added to the current version.

I hope this link can help you to make your own data source with the Abstract class "DataSource" in the module "@angular/cdk/collections"

https://github.com/angular/material2/issues/6036

Related