Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rahulsahay19/2ba4e4f241d4604c12afd36d78792e82 to your computer and use it in GitHub Desktop.
Save rahulsahay19/2ba4e4f241d4604c12afd36d78792e82 to your computer and use it in GitHub Desktop.
newRequest() {
const request = new HttpRequest(
"POST", "/api/progress-request", {},
{reportProgress: true});
this.http.request(request)
.subscribe(
event => {
if (event.type === HttpEventType.DownloadProgress) {
console.log("Download progress", event);
}
if (event.type === HttpEventType.UploadProgress) {
console.log("Upload progress", event);
}
if (event.type === HttpEventType.Response) {
console.log("Response received", event.body);
}
}
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment