AngularMaterial-编译错误-'mat-cell'不是已知元素:
创始人
2024-10-28 07:01:43
0
  1. 确保在你的 app.module.ts 导入了 MatIconModule,MatTableModule 和 BrowserAnimationsModule:

import { BrowserModule } from '@angular/platform-browser'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { MatIconModule } from '@angular/material/icon'; import { MatTableModule } from '@angular/material/table';

@NgModule({ declarations: [ AppComponent ], imports: [ BrowserModule, BrowserAnimationsModule, MatIconModule, MatTableModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }

  1. 如果你在其他模块中使用了 MatTable,你需要在那些模块中导入 MatTableModule。

  2. 如果你的组件使用到 MatTable,确保在组件的 .ts 和 .html 文件中都正确引入了 MatTable:

import { Component } from '@angular/core';

@Component({ selector: 'app-example-table', templateUrl: './example-table.component.html', styleUrls: ['./example-table.component.css'] }) export class ExampleTableComponent {

displayedColumns: string[] = ['position', 'name', 'weight', 'symbol']; dataSource = ELEMENT_DATA;

}

No. {{element.position}} Name {{element.name}} Weight {{element.weight}} Symbol {{element.symbol}}

  1. 如果你对 Angular Material 不熟悉,建议先阅读官方文档:https://material.angular.io/。

相关内容

热门资讯

透视存在!wepoker透视,... 这是一款非常优秀的wepoker透视 ia辅助检测软件,能够让你了解到wepoker透视中牌率当中全...
透视中牌率!wepoker透视... 透视中牌率!wepoker透视版下载,拱趴大菠萝万能辅助器,高科技教程(最初真的是有挂);(需添加指...
透视能赢!wepoker底牌透... 透视能赢!wepoker底牌透视脚本怎样安装,哈糖大菠萝怎么挂,辅助教程(本然真的是有挂);科技安装...
透视黑科技!德普之星有没有挂,... 透视黑科技!德普之星有没有挂,hhpoker外挂靠谱吗,微扑克教程(原本真的有挂);精心打造了俱乐部...
透视中牌率!hhpoker辅助... 透视中牌率!hhpoker辅助软件下载,hhpoker外挂靠谱吗,德州教程(固有有挂);hhpoke...
透视脚本!hhpoker万能辅... 自定义hhpoker万能辅助器系统规律,只需要输入自己想要的开挂功能,一键便可以生成出微扑克专用辅助...
透视能赢!wepoker脚本下... 透视能赢!wepoker脚本下载,哈糖大菠萝开挂,新版2025教程(真是是有挂);亲真的是有正版授权...
透视游戏!wepoker透视脚... 透视游戏!wepoker透视脚本免费下载,wepoker辅助透视软件,2025教程(本然存在有挂);...
透视私人局!wepoker辅助... 透视私人局!wepoker辅助工具,poker红龙辅助,wepoke教程(好像有挂);1分钟了解详细...
透视规律!hhpoker万能辅... WePoker透视辅助工具核心要点解析‌,透视规律!hhpoker万能辅助器,wepoker私人局辅...