【问题标题】:ngx-admin error when using multiple popovers使用多个弹出框时出现 ngx-admin 错误
【发布时间】:2018-11-20 22:53:34
【问题描述】:

我正在使用 ngx-admin NbPopover, 每页 4 个附件。我想在活动结束后关闭活动。

@ViewChild (NbPopoverDirective) popverDirective: NbPopoverDirective;
this.popverDirective.hide();

我只能使用其中一个。其他人不工作。 你能帮忙吗?

【问题讨论】:

    标签: typescript ionic3 angular5 nebular


    【解决方案1】:

    如果您有多个 NbPopoeverDirectives,您可以使用 @ViewChildren 获取它们,因此请尝试以下代码:

    @ViewChildren(NbPopoeverDirective) popovers: QueryList<NbPopoeverDirective>;
    
    ...
    
    hidePopups(){
      if(this.popovers){
         this.popovers.forEach(popover => {
            popove.hide();
          });
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2022-07-14
      • 2020-01-10
      • 2018-08-03
      • 2012-08-21
      • 2020-09-29
      • 2020-03-02
      • 1970-01-01
      • 1970-01-01
      • 2020-10-04
      相关资源
      最近更新 更多