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/。

相关内容

热门资讯

透视工具!拱趴大菠萝自动计算机... 透视工具!拱趴大菠萝自动计算机器人(透视)原来有挂(详细辅助德州论坛);1、很好的工具软件,可以解锁...
玩家必看科普!werplan辅... 玩家必看科普!werplan辅助软件,wepoker辅助真的假的,必胜教程(有挂技巧);小薇(透视辅...
透视有挂!wepoker有没有... 透视有挂!wepoker有没有挂(透视)本来真的有挂(详细辅助教你攻略)亲,关键说明,赛季回归,软件...
推荐一款!werplan免费挂... 推荐一款!werplan免费挂下载,hh poker插件下载,第三方教程(有挂辅助);大神普及一款德...
透视游戏!德扑HHpoker有... 透视游戏!德扑HHpoker有挂吗(透视)真是真的有挂(详细辅助教你攻略)1、机器人多个强度级别选择...
透视存在!poker mast... 透视存在!poker master辅助(透视)果然真的有挂(详细辅助揭秘攻略)1、用户打开应用后不用...
推荐几款新版!aapoker脚... 推荐几款新版!aapoker脚本怎么用,wepoker辅助透视软件,技巧教程(有挂透视)准备好在we...
教程辅助!hhpoker作弊码... 教程辅助!hhpoker作弊码,wepokerplus透视脚本免费,靠谱教程(有挂攻略)1、许多玩家...
透视规律!wepoker看底牌... 透视规律!wepoker看底牌(透视)都是存在有挂(详细辅助技巧教程)1、构建自己的辅助插件;2、选...
一分钟快速了解!拱趴大菠萝开挂... 一分钟快速了解!拱趴大菠萝开挂方法,wepoker辅助器官方,2025新版总结(有挂攻略);科技安装...