Skip to content

Commit

Permalink
fix: set uploaderClass from directives
Browse files Browse the repository at this point in the history
  • Loading branch information
kukhariev committed Sep 2, 2019
1 parent b61e05a commit 9a6400b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/uploadx/src/uploader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ export abstract class Uploader implements UploadState {
}

protected abort(): void {
this.offset = undefined;
this._xhr && this._xhr.abort();
}

Expand Down
9 changes: 3 additions & 6 deletions src/uploadx/src/uploadx.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export class UploadxService {
endpoint: '/upload',
autoUpload: true,
concurrency: 2,
uploaderClass: UploaderX,
stateChange: (evt: Uploader) => {
setTimeout(() =>
this.ngZone.run(() => this.eventsStream.next(pick(evt, UploadxService.stateKeys)))
Expand Down Expand Up @@ -102,11 +101,9 @@ export class UploadxService {
}

private addUploaderInstance(file: File, options: UploadxOptions): void {
if (this.options.uploaderClass) {
const uploader = new this.options.uploaderClass(file, options as UploaderOptions);
this.queue.push(uploader);
uploader.status = 'added';
}
const uploader = new (options.uploaderClass || UploaderX)(file, options as UploaderOptions);
this.queue.push(uploader);
uploader.status = 'added';
}

/**
Expand Down

0 comments on commit 9a6400b

Please sign in to comment.