Ng Bootstrap Popover在iOS设备上没有关闭它

时间:2018-06-14 13:42:11

标签: ios angular popover ng-bootstrap

在Angular应用程序中,我有这个ng bootstrap popover:

<a class="d-flex justify-content-end align-self-center mt-0 mr-3"
     role="button"
     placement="bottom-right"
     [ngbPopover]="popoverContentTemplate"
     #p="ngbPopover"
     [closePopoverOnClickOutside]="p">
    <span class="icon-My-Profile"></span>
  </a>

<ng-template #popoverContentTemplate>
  ...

export class ClosePopoverOnClickOutsideDirective {

  active = false;

  @Input('closePopoverOnClickOutside') popover;

  @HostListener('document:click', ['$event.target'])
  onClick(target) {

    if (this.popover._windowRef && !this.popover._windowRef._component._element.nativeElement.contains(target)) {
      if (this.active) {
        this.active = false;
        this.popover.close();
      }
      else this.active = true;
    }

    else this.active = false;
  }

}

closePopoverOnClickOutside是一个指令,用于在单击外部时关闭弹出窗口。它适用于除iOS设备以外的所有设备和浏览器。可能是什么问题?

0 个答案:

没有答案