标签: reportprogress

Angular 上传进度未正确报告

我正在尝试构建一个受本文启发的上传表单:

https://malcoded.com/posts/angular-file-upload-component-with-express/

我使用的是 angular 9 和 ngx-bootstrap,我没有使用对话框或有角的材料。所以,我征收了这样的上传服务:

import { Injectable } from '@angular/core';
import { Observable, Subject } from 'rxjs';
import {
  HttpClient,
  HttpRequest,
  HttpEventType,
  HttpResponse,
} from '@angular/common/http';

import { environment } from '@environments/environment';

@Injectable({
  providedIn: 'root',
})
export class UploadService {
  private url: string = `${environment.apiUrl}/halls/file`;

  constructor(private http: HttpClient) {}

  public upload(
    files: Set<File>
  ): { [key: string]: { progress: Observable<number> } } {
    // this will be the our resulting map
    const status: { [key: string]: { …
Run Code Online (Sandbox Code Playgroud)

upload typescript angular reportprogress

5
推荐指数
1
解决办法
755
查看次数

标签 统计

angular ×1

reportprogress ×1

typescript ×1

upload ×1