angular - mat-button 不是已知元素
问题描述
我不明白。我想我导入了所有必要的模块,但它一直告诉我:
'mat-button' is not a known element:
app.module.ts:
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatButtonModule } from '@angular/material/button';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule,
BrowserAnimationsModule,
MatButtonModule,
],
declarations: [AppComponent],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
app.component.ts:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
styleUrls: ['app.component.scss'],
})
export class AppComponent {
constructor() {}
}
app.component.html
<mat-button>foo</mat-button>
app.component.scss 是空的。
我知道有很多关于这个的帖子。但没有任何帮助,因为我认为我MatButtonModule
正确导入了所有内容 ( )。有人知道我能做什么吗?
解决方案
推荐阅读
- css - 图像在移动设备上拉伸(仅限 iPhone),但在 PC 上的浏览器预览中没有
- google-apps-script - GmailApp.getMessagesForThreads() 返回太多消息
- r - 根据 r 中的某些列将 2 个表连接在一起
- python - 使用 python 发送文件和元数据的未编码多部分/表单数据 POST 请求
- c# - 动态生成控件
- .net - .NET 将一些内容从一个 XML 粘贴到另一个 XML 文件
- mysql - 1and1 IONOS 数据库与 Node.JS
- c# - Unity Editor 在点击播放时冻结几秒钟 - Firebase.Editor 错误
- qt - 如何在 qml 中设计标尺
- outlook-redemption - 通过 RDOmessage.saveas 将 Msg 转换为 Eml 显示韩文的文本损坏