docs: fix division by zero in progress events example (#46077)

If the `event.total` is undefined, this line would have generated a `NaN` due to division by zero. I suppose, that a `0` would be more suitable for this case.

PR Close #46077
This commit is contained in:
Tom Raithel
2022-05-20 20:53:13 +02:00
committed by Alex Rickabaugh
parent 3dec816276
commit 8ea4e1e6eb
@@ -62,7 +62,7 @@ export class UploaderService {
case HttpEventType.UploadProgress:
// Compute and show the % done:
const percentDone = Math.round(100 * event.loaded / (event.total ?? 0));
const percentDone = event.total ? Math.round(100 * event.loaded / event.total) : 0;
return `File "${file.name}" is ${percentDone}% uploaded.`;
case HttpEventType.Response: