Material: Unexpected value 'MatTableDataSource' imported by the module 'AppModule'.

Created on 10 Nov 2017  路  10Comments  路  Source: angular/material

I'm having this issue when fallowing the exact same code from api docs:

https://material.angular.io/components/table/overview

My Dependencies:

"dependencies": {
"@angular/animations": "^5.0.0",
"@angular/cdk": "^5.0.0-rc0",
"@angular/common": "^5.0.0",
"@angular/compiler": "^5.0.0",
"@angular/core": "^5.0.0",
"@angular/forms": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/material": "^5.0.0-rc0",
"@angular/platform-browser": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/router": "^5.0.0",
"core-js": "^2.4.1",
"rxjs": "^5.5.2",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular/cli": "1.5.0",
"@angular/compiler-cli": "^5.0.0",
"@angular/language-service": "^5.0.0",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"codelyzer": "~3.2.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "^2.4.2"
}

Didn't found anything related to angular-material on google.

invalid

Most helpful comment

Hello
I had the same problem, and reinstalled everything but first update the packages with

https://www.npmjs.com/package/npm-check-updates

npm install -g npm-check-updates

ncu -u

After updating the packege.json I gave it a

npm install

All 10 comments

Hello
I had the same problem, and reinstalled everything but first update the packages with

https://www.npmjs.com/package/npm-check-updates

npm install -g npm-check-updates

ncu -u

After updating the packege.json I gave it a

npm install

I tried but got the same error. I didn't removed node_modules, just use npm install

Since eu solved updating packages, must be conflicting versions.

Solved importing MatTableModule and MatTableDataSource since i didnt imported all components.

@jeanbacan Could you outline which components were missing? I'm having the same issue as you.

This issue is posted in the wrong repository. This is the AngularJS Material repo and not the Angular Material repo. Please re-post this issue here: https://github.com/angular/material2/issues/new

@dliebel thanks! your solution work for me!

Thanks @dliebel that worked for me also.
Most likely I needed to update "@angular/material" and "@angular/cdk" to "5.0.0-rc.2".

Great @dliebel . It worked like a charm.

thanks @dliebel . it worked

Well The simplest thing to do is Remove import and export of the MatTableDataSource from your MaterialModule (that is if you created a seperate shared module for material design compoents and submodules).

Remove the import of MatTableDataSource from appModule also.
Just import it from @angular/core on the component where you choose to use it. It worked for me well on angular 6

Was this page helpful?
0 / 5 - 0 ratings