【问题标题】: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();
});
}
}