我使用Angular Material组件并尝试使用预制主题
我将此行添加到组件css @import '@angular/material/prebuilt-themes/deeppurple-amber.css';
但仍然出现错误
找不到Angular Material核心主题。大多数材料组件可能无法正常工作。有关更多信息,请参考主题指南:https://material.angular.io/guide/theming
这是app.module.ts代码
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {CustomMaterialModule} from "./CustomMaterialModule";
import { PaymentsComponent } from './payments/payments.component';
import { MatPaginatorModule, MatCheckboxModule} from '@angular/material';
import {FormsModule, ReactiveFormsModule} from '@angular/forms';
@NgModule({
declarations: [
AppComponent,
PaymentsComponent
],
imports: [
BrowserModule,
CustomMaterialModule,
AppRoutingModule,
MatPaginatorModule,
MatCheckboxModule,
FormsModule,
ReactiveFormsModule,
BrowserAnimationsModule,
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
哪里有麻烦?
答案 0 :(得分:1)
好像我找到了答案
我需要添加
providers: [
{
provide: MATERIAL_SANITY_CHECKS,
useValue: false
}
],
进入app.module.ts,现在没有这个错误