From 704a51a9a84294edb5040424044c11579d00382e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Saleiro?= Date: Tue, 27 Jun 2017 14:52:00 +0100 Subject: [PATCH] Update ng-file-select.directive.ts --- src/ngx-uploader/directives/ng-file-select.directive.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ngx-uploader/directives/ng-file-select.directive.ts b/src/ngx-uploader/directives/ng-file-select.directive.ts index ed0229f5..6499016f 100644 --- a/src/ngx-uploader/directives/ng-file-select.directive.ts +++ b/src/ngx-uploader/directives/ng-file-select.directive.ts @@ -32,7 +32,9 @@ export class NgFileSelectDirective implements OnInit, OnDestroy { ngOnDestroy() { this.el.removeEventListener('change', this.fileListener, false); - this.uploadInput.unsubscribe(); + + if (this.uploadInput) + this.uploadInput.unsubscribe(); } fileListener = () => {