有人可以帮我解决此错误吗? “ this.healthRecord.documents未定义”

时间:2019-07-10 09:43:10

标签: javascript java android

我是Java和Javascript的初学者。 该Java API已经有效并且处于在线状态。 我无法解决此错误_this.healthRecord.documents is undefined。 当我尝试在患者资料网页中添加文件时,它是在控制台(F12)中写的。

我还可以完全访问后面和前面的代码源。 前面的代码在打字稿中(有角)。

这是上传文件的前端代码部分:

this.documentsUploader.onCompleteAll = () => {
}

this.documentsUploader.onCompleteItem = (item: any, response: any, status: any, headers: any) => {
  let documentFile: DocumentModel = JSON.parse(response);
  this.healthRecord.documents.push(documentFile);
  this.healthRecord.documents = this.utilsService.deepArrayCopyDocuments(this.healthRecord.documents);
  this.addingDocument = false;
  this.notificationsService.success(NotificationConstants.DOCUMENT_SENT_MESSAGE_SUCCESS, '', NotificationConstants.PROPERTIES);
};

this.documentsUploader.onWhenAddingFileFailed = (item: any, filter: any, options: any) => {
  console.log('***** onWhenAddingFileFailed ********');
}


this.uploadForm = this.fb.group({
  document: [null, null],
  type: [null, Validators.compose([Validators.required])]
});
}

save() {
this.patientService.patchHealthRecord(this.healthRecord).subscribe((profile: HealthRecordModel) => {
  this.healthRecord = profile;
  this.notificationsService.success(NotificationConstants.HEALTHRECORD_SENT_MESSAGE_SUCCESS, '', NotificationConstants.PROPERTIES);
}, () => {
  this.notificationsService.error(NotificationConstants.MESSAGE_ERROR, '', NotificationConstants.PROPERTIES);
})
}

实际上,无法添加文件,当我尝试执行此操作时,“添加文件”按钮选择该文件,但不添加为文件列表。

0 个答案:

没有答案