我正在从事Angular项目。
我尝试将委托传递给函数。我有这个:
saveDocumentForDiploma(documents: DocumentModel[], successDelegate: () => void, resources: any, resourceKeys: any) {
return this.multiFileUploadService.syncFilesWithBackend(`${this.apiDiploma}/documents`, documents, resources.bijlageToevoegenSpinnerTekst,
resources.bijlageVerwijderenSpinnerTekst).pipe(map((docSaveResult) => {
const errors = docSaveResult.filter(item => item.error !== undefined);
this.getDiplomaDocumentList().subscribe(() => {
if (errors.length > 0) {
const errorMessage = this.multiFileUploadService.makeWarningMessageForUnsyncedFiles(errors, resources,
resourceKeys.synchroniserenBestandenMisluktWaarschuwingTekst,
resourceKeys.bijlageMetTitelMisluktWarningTekst,
resourceKeys.verwijderdActieTekst,
resourceKeys.toegevoegdActieTekst);
this.feedbackStoreService.addErrorMessage({
feedbackPortalKey: FeedbackPortalsModel.mainFeedback,
message: {
key: 'documentSyncFoutTekst',
value: errorMessage,
},
});
} else {
successDelegate();
}
});
}));
}
然后我尝试调用这种方法:
diplomaDataSubmitted() {
if (this.allowSubmitAgain && this.formModel && this.formModel.form.valid) {
this.formService.formStoreService.hideValidationSummary(this.formName);
const obs = this.diplomaService.saveDiplomaMetaData(false, 'TODO').pipe(map(() => {
const documents: DocumentModel[] = this.formModel.getAngularFormControl(DiplomaFormKeysModel.keys.diplomasUpload).value.files;
this.diplomaService.saveDocumentForDiploma(documents, successDelegate: () => void, resources, resourceKeys).subscribe(() => {
});
}));
this.submitAllowed(obs);
} else {
this.formService.formStoreService.showValidationSummary(this.formName);
}
}
但是我在这条线上出现错误:
this.diplomaService.saveDocumentForDiploma(documents, successDelegate: () => void, resources, resourceKeys).subscribe(() => {
});
那该如何解决呢?
谢谢