Mat-accordion is not a known element

Viewed 3682

I am working on an angular10 application, I am trying to use mat-accordion in my project, using modules per component(each and every component has it own module.ts file) below is my module file code

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { CaseCardComponent } from '../casecard/casecard.component';
import { MatExpansionModule } from '@angular/material/expansion';
import {MatCardModule} from '@angular/material/card';





 @NgModule({
      declarations: [CaseCardComponent],
      imports: [
        CommonModule,
        MatExpansionModule,
        MatCardModule
      ]
    })
    export class CasecardModule { }

then below is the line that throws an error "Mat-accordion is not a known element" (this is in the html file)

<mat-accordion>
    
</mat-accordion>

What is funny though, is the tag from the MatCardModule seems to be working perfectly(used it as test just to see if perhaps that something wrong with the module itself), is the something I am doing wrong here

Note: Importing MatCardExpansion module as suggested by many others did not really help me

2 Answers

Did you stop & restart your development server of angular? Sometimes adding modules (or doing npm install) while ng serve is active does not correctly update.

Maybe is something stupid, but in my case, I did everything I saw in SO and nothing worked until I put the MatExpansionModule before the other Mat*Modules I have...

Related