jong shin
jong shin

Reputation: 794

Angular Material TypeError: Cannot read property 'id' of undefined

After installing angular material and adding the components in app.module, I'm getting this error

TypeError: Cannot read property 'id' of undefined.

Upvotes: 1

Views: 729

Answers (2)

Sean Combs
Sean Combs

Reputation: 176

I was having the same issue as you were having until I found your question! Yes. You are correct about importing the module. Importing non-modules will cause Angular to fail in runtime. The function registerNgModuleType(ngModuleType), which is the one causing the failure, is meant for modules only, and it is run on each import. So anything without an ngModuleType is not a module, and cannot be properly passed through this function.

Upvotes: 1

jong shin
jong shin

Reputation: 794

It turned out, I was importing the components, NOT the modules. enter image description here

Should not import the components.

enter image description here

Should import the modules.

Upvotes: 5

Related Questions