在哪里获得响应ngx-uploader?

时间:2019-02-15 10:20:47

标签: ngx-uploader

我上传的网址中有一个JSON响应,但是在代码中我找不到它,你能建议在哪里以及如何获得它吗?

onUploadOutput(output: UploadOutput): void {

if (output.type === 'allAddedToQueue') {
  const event: UploadInput = {
    type: 'uploadAll',
    url: this.url,
    method: 'POST',
    data: {foo: 'bar'}
  };

  this.uploadInput.emit(event);

........

} else if (output.type === 'done') {
  this.files.forEach(file => {
    console.log('ciao'); //DIDN'T WORK
    console.log(file.response); //DIDN'T WORK
    this.uploadInput.emit(file.response);
  });
}

this.files = this.files.filter(file => file.progress.status !== UploadStatus.Done);

  }
}

1 个答案:

答案 0 :(得分:0)

找到了解决方案,编辑ngx-uploader模块,并在ngx-uploader.js中更改有关第236行的代码:


    xhr.onreadystatechange = () => {
    if (xhr.readyState === 4) {
    /** @type {?} */