【问题标题】:How can I hide component when I use ng-zorro?使用 ng-zorro 时如何隐藏组件?
【发布时间】:2019-07-11 07:29:18
【问题描述】:

我使用 Angular 7 和 ng-zorro,我想在单击登录按钮时隐藏侧边栏。

我试过这个"[(nzVisible)]="isVisible"。但它不起作用。

未捕获的错误:模板解析错误: 无法绑定到“nzVisible”,因为它不是“div”的已知属性。enter code here

【问题讨论】:

  • 欢迎来到stackoverflow!你能提供你想隐藏的整个元素吗?你试过[hidden]="!isVisible"ngIf="isVisible"
  • 非常感谢,我都试过了,效果很好。

标签: angular ng-zorro-antd


【解决方案1】:

只需添加*ngIf="condition"

工作示例ng-zorro-antd-start

    <button nz-button *ngIf="false" nzType="primary" >Primary</button>
        <---hides component
    <button nz-button nzType="primary" >Primary</button>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-09-27
    • 1970-01-01
    • 1970-01-01
    • 2019-05-19
    • 2020-12-17
    相关资源
    最近更新 更多