Hello everyone I'm uploading file to backend and I want to get upload percentage and display it in progress bar:
Adding file ts component:
this.updateDokumentSub = this.dokumentiService.insertDokument(obj).pipe(takeUntil(this.destroy$)).subscribe((data: any) => {
this.toastService.showToast('success', 'Novi dokument uspješno dodan', '');
form.resetForm();
this.close(true);
this.dokumentiService.emitAddDokument(obj);
this.loading = false;
this.spinner.hide();
},
err => {
console.error(err);
this.loading = false;
this.spinner.hide();
});
Service file for uploading:
insertDokument(object: any): Observable<Object> {
return this.http.post(this.apiRoute + '/insertDok', {
}, object);
}
And here is my progress bar:
<nb-progress-bar [value]="40" status="primary" [displayValue]="true"></nb-progress-bar>
Appreciate if someone can advise. Thank you in advance!