Skip to content

Commit

Permalink
fix(file-service): make progress based on upload API (#728)
Browse files Browse the repository at this point in the history
Make progress upload based on upload, not need backend compatible
  • Loading branch information
rafal83 authored and emoralesb05 committed Jul 3, 2017
1 parent 4d15d69 commit 9180f99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platform/core/file/services/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ export class TdFileService {
return subscriber.error('For [IUploadOptions] you have to set either the [file] or the [formData] property.');
}

xhr.onprogress = (event: ProgressEvent) => {
xhr.upload.onprogress = (event: ProgressEvent) => {
let progress: number = 0;
if (event.total > 0) {
if (event.lengthComputable) {
progress = Math.round(event.loaded / event.total * 100);
}
this._progressSubject.next(progress);
Expand Down

0 comments on commit 9180f99

Please sign in to comment.