From 7330f4742cbf1091431d6d2092c9dda0c2c21c12 Mon Sep 17 00:00:00 2001 From: Dmytro Zaverukha Date: Tue, 17 Jan 2017 16:48:29 +0200 Subject: [PATCH] fix: add checking for not udefined document object (#541) * Add checking for not udefined document object * fix braces --- components/select/off-click.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/select/off-click.ts b/components/select/off-click.ts index a3372bb9..2368c06c 100644 --- a/components/select/off-click.ts +++ b/components/select/off-click.ts @@ -13,10 +13,10 @@ export class OffClickDirective implements OnInit, OnDestroy { } public ngOnInit(): any { - setTimeout(() => {document.addEventListener('click', this.offClickHandler);}, 0); + setTimeout(() => { if(typeof document !== 'undefined') { document.addEventListener('click', this.offClickHandler); } }, 0); } public ngOnDestroy(): any { - document.removeEventListener('click', this.offClickHandler); + if(typeof document !== 'undefined') { document.removeEventListener('click', this.offClickHandler); } } }