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

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

问题描述

我正在使用 Angular Material 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 Table

I found out that cdkHeaderCellDef and cdkCellDef are from CDK Table

我收到错误消息无法绑定到 'cdkHeaderRowDef',因为它不是 'md-header-row' 的已知属性."

我该如何解决这个问题?

How can I solve this ?

推荐答案

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天全站免登陆