0

It's working

import { MatButtonModule } from '@angular/material/button'
import { MatMenuModule } from '@angular/material/menu'

Not Working

import { MatButtonModule,MatMenuModule } from '@angular/material' 

Why do you think it would be?

7
  • How are you saying it is not working do you get any errors?? If so edit the question with relevant details.. Commented Mar 11, 2020 at 9:13
  • @ManirajMurugan I think it makes no sense. Error Message: ERROR in src/app/materials/materials.module.ts:3:46 - error TS2306: File '......../Projects/aviyiva/node_modules/@angular/material/index.d.ts' is not a module. 3 import { MatButtonModule,MatMenuModule} from '@angular/material' Commented Mar 11, 2020 at 9:15
  • You can look at the example here stackblitz.com/edit/angular-6-material-starter-76hgza it is working fine only.. Commented Mar 11, 2020 at 9:21
  • 1
    You might have upgraded your angular cli version to 9! Commented Mar 11, 2020 at 9:26
  • 1
    Yes with Angular 9, you will have to import each component separately. This is a major change they introduced. Commented Mar 11, 2020 at 9:34

1 Answer 1

3

That's no longer supported in Angular's 9th version.

Components can no longer be imported through "@angular/material". Use the individual secondary entry-points, such as @angular/material/button.

Source: git issue and changelog

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.