Angular Material 2中的md-table [英] md-table in Angular Material 2

查看:200
本文介绍了Angular Material 2中的md-table的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用角度材料表.在HTML代码中,

I am working with Angular Material Table. In Html code, there is

<ng-container cdkColumnDef="userId">
  <md-header-cell *cdkHeaderCellDef> ID </md-header-cell>
  <md-cell *cdkCellDef="let row"> {{row.id}} </md-cell>
</ng-container>

我发现cdkHeaderCellDef和cdkCellDef来自 CDK表

I found out that cdkHeaderCellDef and cdkCellDef are from CDK Table

我在收到错误消息时说:"由于它不是'md-header-row'的已知属性,因此无法绑定到'cdkHeaderRowDef'."

I am getting error saying "Can't bind to 'cdkHeaderRowDef' since it isn't a known property of 'md-header-row'."

我该如何解决?

推荐答案

cdkHeaderCellDefcdkCellDef@angular/cdk库的一部分,并导出到CdkTableModule中.

The cdkHeaderCellDef and cdkCellDef are part of the @angular/cdk library and exported in the CdkTableModule.

将此模块包含在应用程序的导入文件中

Include this module in your app's imports

这篇关于Angular Material 2中的md-table的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆