Skip to content

Commit d8e614c

Browse files
committed
fix(modals): don't try to register outside click handler
fixes #2477
1 parent e59172f commit d8e614c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/component-loader/component-loader.class.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,16 @@ export class ComponentLoader<T> {
248248
return;
249249
}
250250
// why: should run after first event bubble
251-
const target = this._componentRef.location.nativeElement;
252-
setTimeout(() => {
253-
this._globalListener = registerOutsideClick(this._renderer, {
254-
targets: [target, this._elementRef.nativeElement],
255-
outsideClick: this._listenOpts.outsideClick,
256-
hide: () => this._listenOpts.hide()
251+
if (this._listenOpts.outsideClick) {
252+
const target = this._componentRef.location.nativeElement;
253+
setTimeout(() => {
254+
this._globalListener = registerOutsideClick(this._renderer, {
255+
targets: [target, this._elementRef.nativeElement],
256+
outsideClick: this._listenOpts.outsideClick,
257+
hide: () => this._listenOpts.hide()
258+
});
257259
});
258-
});
260+
}
259261
}
260262

261263
public getInnerComponent(): ComponentRef<T> {

0 commit comments

Comments
 (0)