这个问题通常出现在使用 ngx-buton 模块时,它需要依赖@angular/material 模块。需要确保安装了 @angular/material 模块,并将其导入到模块中。以下是一个示例:
app.module.ts:
import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { AppComponent } from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
MatButtonModule // 导入 MatButton 模块
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
在组件文件中使用时,可以这样引入:
import { ButtonFillMode } from '@angular/material/button';
// ...
export class MyComponent implements OnInit {
fillMode = ButtonFillMode.Solid;
// ...
}