How to show progress bar during loading when loading data from API?
Thanks.
How to show progress bar during loading when loading data from API?
Thanks.
http.request(req).subscribe(event => {
// Via this API, you get access to the raw event stream.
// Look for upload progress events.
if (event.type === HttpEventType.UploadProgress) {
// This is an upload progress event. Compute and show the % done:
const percentDone = Math.round(100 * event.loaded / event.total);
console.log(`File is ${percentDone}% uploaded.`);
} else if (event instanceof HttpResponse) {
console.log('File is completely uploaded!');
}
});
Try this might be this will help
What do I need to replace UploadProgress?
Here you will get this
https://angular.io/api/common/http/HttpEventType