From 5d171ad9b5dec9d56e3692a9b728b33a0069a595 Mon Sep 17 00:00:00 2001 From: Jan Kuri Date: Sun, 20 Nov 2016 20:49:03 +0100 Subject: [PATCH] minor --- package.json | 2 +- src/directives/ng-file-select.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c4b28247..2ff5bff2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ng2-uploader", "description": "Angular2 File Uploader", - "version": "1.5.0", + "version": "1.5.1", "license": "MIT", "main": "ng2-uploader.js", "typings": "ng2-uploader.d.ts", diff --git a/src/directives/ng-file-select.ts b/src/directives/ng-file-select.ts index 039b6fab..8c781f21 100644 --- a/src/directives/ng-file-select.ts +++ b/src/directives/ng-file-select.ts @@ -18,13 +18,13 @@ export class NgFileSelectDirective { @Output() onPreviewData: EventEmitter = new EventEmitter(); @Output() onUploadRejected: EventEmitter = new EventEmitter(); - _options:any; + _options: any; - @Input() get options(): any { return this._options; } + @Input('options') set options(value: any) { this._options = value; this.uploader.setOptions(this.options); @@ -82,6 +82,10 @@ export class NgFileSelectDirective { } @HostListener('change') onChange(): void { + if (!this.el.nativeElement.files) { + return; + } + this.files = Array.from(this.el.nativeElement.files); if (this.options.filterExtensions && this.options.allowedExtensions) { this.filterFilesByExtension();