From 96edf1af751e79de2c13888bd3dd935c14d4b30f Mon Sep 17 00:00:00 2001 From: MrFrankel Date: Tue, 4 Sep 2018 14:02:29 +0300 Subject: [PATCH] gix for #73, hide on clickoutside for mobile devices --- package.json | 2 +- src/popper-content.ts | 2 +- src/popper-directive.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 430f3dc..1ab0e91 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ngx-popper", - "version": "5.0.6", + "version": "5.1.6", "description": "ngx-popper is an angular wrapper for popper.js", "directories": { "test": "test" diff --git a/src/popper-content.ts b/src/popper-content.ts index d69e3a7..65f5ee0 100644 --- a/src/popper-content.ts +++ b/src/popper-content.ts @@ -5,7 +5,7 @@ import { ViewChild, EventEmitter, ViewEncapsulation, - HostListener, Renderer2, ViewRef, ViewContainerRef, + HostListener, Renderer2, ViewContainerRef, } from "@angular/core"; import Popper from 'popper.js'; import {Placements, Triggers, PopperContentOptions} from './popper-model'; diff --git a/src/popper-directive.ts b/src/popper-directive.ts index f541c50..acf1d77 100644 --- a/src/popper-directive.ts +++ b/src/popper-directive.ts @@ -262,6 +262,7 @@ export class PopperController implements OnInit, OnChanges { if (this.timeoutAfterShow > 0) { this.scheduledHide(null, this.timeoutAfterShow); } + this.globalEventListeners.push(this.renderer.listen('document', 'touchend', this.hideOnClickOutsideHandler.bind(this))); this.globalEventListeners.push(this.renderer.listen('document', 'click', this.hideOnClickOutsideHandler.bind(this))); this.globalEventListeners.push(this.renderer.listen(this.getScrollParent(this.getRefElement()), 'scroll', this.hideOnScrollHandler.bind(this))); }