How to use mat-tab? mat-tab is not a known element error
I had the same issue. I was getting error 'mat-tab' is not a known element even after importing both modules
The fix for me wasnpm install --save @angular/cdk @angular/material
Add the import in your module.ts file and add it to imports (if you use several module.ts files, add it in the one which is responsible for your component).
import { MatTabsModule } from '@angular/material';
@NgModule({
imports: [
...
MatTabsModule,
...
],
declarations: [
...
],
providers: []
})
export class AppModule {}
For Angular 9+:
import { MatTabsModule } from '@angular/material/tabs';
in app.module.ts