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怎么破解游戏,wepoker高级辅助,阶段教程(了解有挂)-哔哩哔哩wepo...
透视教程!aapoker怎么选... 透视教程!aapoker怎么选牌,德州hhpoker脚本,演示教程(存在有挂)-哔哩哔哩1、点击下载...
透视辅助!德州局怎么透视,aa... 透视辅助!德州局怎么透视,aapoker ai插件,模板教程(有挂辅助)-哔哩哔哩1、很好的工具软件...
透视肯定!wpk透视是真的假的... 透视肯定!wpk透视是真的假的,德州局怎么透视,窍要教程(的确有挂)-哔哩哔哩1、wpk透视是真的假...
透视智能ai!wepokerp... 透视智能ai!wepokerplus脚本,wepoker怎么获得好牌,攻略教程(有挂技巧)-哔哩哔哩...
透视系统!德州局透视脚本下载安... 透视系统!德州局透视脚本下载安装最新版本,wpk安卓下载辅助,课程教程(有挂教学)-哔哩哔哩1、下载...
透视辅助!德普之星透视辅助软件... 透视辅助!德普之星透视辅助软件是真的吗,wepoker底牌透视,妙计教程(有挂方针)-哔哩哔哩1、这...
透视真的!hhpoker辅助靠... 透视真的!hhpoker辅助靠谱吗,pokerworld破解版下载,讲义教程(有挂方针)-哔哩哔哩1...
透视脚本!aapoker辅助工... 透视脚本!aapoker辅助工具安全吗,hhpoker视频巡查真的假的,练习教程(揭秘有挂)-哔哩哔...
透视黑科技!来玩德州破解器,w... 透视黑科技!来玩德州破解器,we-poker软件,诀窍教程(今日头条)-哔哩哔哩1、玩家可以在来玩德...