作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有办法使用 @Input()
显示/隐藏 Material 表页脚多变的?我正在尝试构建一个自定义表格组件,它可能有也可能没有页脚,就像这样
<my-component [showFooter]="false"></my-component>
*ngIf
在
mat-footer-row
在组件定义中。但是当我尝试使用
<tr *ngIf="showFooter" *matFooterRowDef="displayedColumns; sticky: true"></tr>
<td *ngIf="showFooter" mat-footer-cell *matFooterCellDef>{{someValue}}</td>
Can't have multiple template bindings on one element. Use only one attribute prefixed with *
*ngIf
实现它,那么实现它的正确方法是什么? ?
最佳答案
您只能在单个元素上使用一个结构指令(用 * 表示)。
您可以使用 ng-container
:
<ng-container *ngIf="showFooter">
<td mat-footer-cell *matFooterCellDef>{{someValue}}</td>
</ng-container>
关于angular - 如何以编程方式显示/隐藏 Material 表页脚?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58429016/
我是一名优秀的程序员,十分优秀!