From d8e614c6b3c2a945394efef079b3a9f74b375a35 Mon Sep 17 00:00:00 2001 From: Dmitriy Shekhovtsov Date: Wed, 23 Aug 2017 14:22:30 +0300 Subject: [PATCH] fix(modals): don't try to register outside click handler fixes #2477 --- src/component-loader/component-loader.class.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/component-loader/component-loader.class.ts b/src/component-loader/component-loader.class.ts index 02573a365d..751c42d95b 100644 --- a/src/component-loader/component-loader.class.ts +++ b/src/component-loader/component-loader.class.ts @@ -248,14 +248,16 @@ export class ComponentLoader { return; } // why: should run after first event bubble - const target = this._componentRef.location.nativeElement; - setTimeout(() => { - this._globalListener = registerOutsideClick(this._renderer, { - targets: [target, this._elementRef.nativeElement], - outsideClick: this._listenOpts.outsideClick, - hide: () => this._listenOpts.hide() + if (this._listenOpts.outsideClick) { + const target = this._componentRef.location.nativeElement; + setTimeout(() => { + this._globalListener = registerOutsideClick(this._renderer, { + targets: [target, this._elementRef.nativeElement], + outsideClick: this._listenOpts.outsideClick, + hide: () => this._listenOpts.hide() + }); }); - }); + } } public getInnerComponent(): ComponentRef {