I started angular two months ago, I designed an application and doing the ng test I have this error:
Failed: Template parse errors: 'mat-card-title' is not a known element: 1. If 'mat-card-title' is an Angular component, then verify that it is part of this module. 2. If 'mat-card-title' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@ NgModule.schemas' of this component to suppress this message. I do not understand what does not work in my code.
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { HeroService } from './hero.service';
import { AngularFireAuthModule } from '@angular/fire/auth';
import { AngularFireModule } from '@angular/fire';
import { AngularFirestoreModule } from '@angular/fire/firestore';
import { AngularFireStorageModule } from '@angular/fire/storage';
import { AngularMaterialModule } from './angular-material/angular-material.module';
import { environment } from 'src/environments/environment';
import { FormsModule } from '@angular/forms';
import { ToastrModule } from 'ngx-toastr';
import { HeroesListComponent } from './heroes-list/heroes-list.component';
import { HeroDetailComponent } from './hero-detail/hero-detail.component';
import { HeroSearchComponent } from './hero-search/hero-search.component';
import { HeroTableComponent } from './hero-table/hero-table.component';
import { LoginComponent } from './login/login.component';
import { NavbarHeroesComponent } from './navbar-heroes/navbar-heroes.component';
import { AddHeroesComponent } from './add-heroes/add-heroes.component';
import { HeroGridComponent } from './hero-grid/hero-grid.component';
import { FlexLayoutModule } from '@angular/flex-layout';
@NgModule({
declarations: [
AppComponent,
LoginComponent
],
imports: [
BrowserModule,
AppRoutingModule,
BrowserAnimationsModule,
FormsModule,
AngularFireModule.initializeApp( environment.firebaseConfig ),
AngularFirestoreModule,
FlexLayoutModule,
AngularFireAuthModule,
AngularFireStorageModule,
ToastrModule.forRoot(),
AngularMaterialModule
],
providers: [
HeroService
],
bootstrap: [AppComponent]
})
export class AppModule { }
this is AngularMaterialModule
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import {
MatButtonModule,
MatTableModule,
MatIconModule,
MatFormFieldModule,
MatSelectModule,
MatInputModule,
MatRadioModule,
MatToolbarModule,
MatCardModule,
MatGridListModule,
MatCheckboxModule,
} from '@angular/material';
const moduleAngularMaterial = [
MatButtonModule,
MatIconModule,
MatFormFieldModule,
MatSelectModule,
MatInputModule,
MatTableModule,
MatCheckboxModule,
MatRadioModule,
MatToolbarModule,
MatCardModule,
MatGridListModule
];
@NgModule({
declarations: [
],
imports: [
moduleAngularMaterial,
CommonModule
],
exports: [
moduleAngularMaterial
],
})
export class AngularMaterialModule { }
These kind of issues comes when component module is either:
Depending on the scenario of your project, either: