Skip to content

Commit

Permalink
Allows setting of false boolean options
Browse files Browse the repository at this point in the history
  • Loading branch information
zatomik committed Mar 14, 2016
1 parent 4d435d8 commit 2dc9efb
Showing 1 changed file with 19 additions and 18 deletions.
37 changes: 19 additions & 18 deletions src/services/ng2-uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,24 +73,25 @@ export class Ng2Uploader {
_emitter: EventEmitter<any> = new EventEmitter(true);

setOptions(options: any): void {
this.url = options && options.url || this.url;
this.cors = options && options.cors || this.cors;
this.withCredentials = options && options.withCredentials || this.withCredentials;
this.multiple = options && options.multiple || this.multiple;
this.maxUploads = options && options.maxUploads || this.maxUploads;
this.allowedExtensions = options && options.allowedExtensions || this.allowedExtensions;
this.maxSize = options && options.maxSize || this.maxSize;
this.data = options && options.data || this.data;
this.noParams = options && options.noParams || this.noParams;
this.autoUpload = options && options.autoUpload || this.autoUpload;
this.multipart = options && options.multipart || this.multipart;
this.method = options && options.method || this.method;
this.debug = options && options.debug || this.debug;
this.customHeaders = options && options.customHeaders || this.customHeaders;
this.encodeHeaders = options && options.encodeHeaders || this.encodeHeaders;
this.authTokenPrefix = options && options.authTokenPrefix || this.authTokenPrefix;
this.authToken = options && options.authToken || this.authToken;
this.fieldName = options && options.fieldName || this.fieldName;

this.url = options.url != null ? options.url : this.url;
this.cors = options.cors != null ? options.cors : this.cors;
this.withCredentials = options.withCredentials != null ? options.withCredentials : this.withCredentials;
this.multiple = options.multiple != null ? options.multiple : this.multiple;
this.maxUploads = options.maxUploads != null ? options.maxUploads : this.maxUploads;
this.allowedExtensions = options.allowedExtensions != null ? options.allowedExtensions : this.allowedExtensions;
this.maxSize = options.maxSize != null ? options.maxSize : this.maxSize;
this.data = options.data != null ? options.data : this.data;
this.noParams = options.noParams != null ? options.noParams : this.noParams;
this.autoUpload = options.autoUpload != null ? options.autoUpload : this.autoUpload;
this.multipart = options.multipart != null ? options.multipart : this.multipart;
this.method = options.method != null ? options.method : this.method;
this.debug = options.debug != null ? options.debug : this.debug;
this.customHeaders = options.customHeaders != null ? options.customHeaders : this.customHeaders;
this.encodeHeaders = options.encodeHeaders != null ? options.encodeHeaders : this.encodeHeaders;
this.authTokenPrefix = options.authTokenPrefix != null ? options.authTokenPrefix : this.authTokenPrefix;
this.authToken = options.authToken != null ? options.authToken : this.authToken;
this.fieldName = options.fieldName != null ? options.fieldName : this.fieldName;

if (!this.multiple) {
this.maxUploads = 1;
Expand Down

0 comments on commit 2dc9efb

Please sign in to comment.