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底牌透视脚本(素来是有挂)是一款可以让一直输的玩...
一分钟揭秘!新超凡软甲辅助(辅... 一分钟揭秘!新超凡软甲辅助(辅助挂)wepoker亲友圈有用吗(素来真的是有挂);详细新超凡软甲辅助...
免费测试版!微乐广西麻辣辅助(... 免费测试版!微乐广西麻辣辅助(辅助挂)wepoker有辅助功能吗(切实是真的有挂);1.微乐广西麻辣...
教程攻略!广东雀神智能插件辅助... 教程攻略!广东雀神智能插件辅助脚本(辅助挂)wepokerplus脚本(从前存在有挂);广东雀神智能...
分享一款!老友广东麻将有挂吗(... 分享一款!老友广东麻将有挂吗(辅助挂)werplan脚本(一贯真的是有挂);老友广东麻将有挂吗软件透...
带你了解!陕西微乐小程序辅助(... 带你了解!陕西微乐小程序辅助(辅助挂)wepoker有插件吗(往昔是有挂)相信很多朋友都在电脑上玩过...
一分钟了解!吉祥填大坑小程序辅... 一分钟了解!吉祥填大坑小程序辅助(辅助挂)wepoker游戏下载(果然真的是有挂);1、很好的吉祥填...
终于清楚!广东闲来app辅助(... 终于清楚!广东闲来app辅助(辅助挂)wpk透视工作室(原先是真的有挂);广东闲来app辅助免费下载...