Angular6:-无法下载表格

时间:2018-07-30 15:24:29

标签: javascript angular typescript angular5 angular6

使用get方法下载表单时出现错误。

下面是来自component.ts的方法

downloadPrefilledForm(): void {
        this.formService.setSelectedFormsFromCheckedForms();
        for (let i = 0; i < this.formService.selectedForms.length; i++) {
          if (this.formService.selectedForms[i].tokenList.length > 0) {
         // Below line is coming as undefined         
    this.formService.downloadPrefilledForm(this.formService.selectedForms[i]);
          } 
        }
      }

对于this.formService.selectedForms[0],我得到的答复是

 {
  "body": [
    {
      "formName": "A_RFR-FSA_HCRA_1XA",
      "formDescription": "A_RFR-FSA_HCRA_1XA",
      "mailAllowed": true,
      "formUrl": "/common/nc/A_RFR_FSA_HCRA_1XA.pdf",
      "formLinkType": null,
      "formTypeID": 63,
      "formSize": 398,
      "tokenList": [
        "EmailID",
        "Employer_Name",
        "First_Name",
        "Last_Name",
        "SSN"
      ],
      "formFileName": "A_RFR_FSA_HCRA_1XA.pdf"
    }
  ]
}

在form.service.ts中,我有

 downloadPrefilledForm(selectedForm: Form) {
    let prefilledFormURL: string = '';
    prefilledFormURL = this.getChildObject('ACCTTAB.FORMS.DOWNLOADPREFILLEDFORM.GET').href + '&formId=' + selectedForm.formTypeID +
      '&formUrl=' + selectedForm.formUrl + '&tokenList=' + selectedForm.tokenList;
    this.windowRef.nativeWindow.open(prefilledFormURL);
  }

`this.getChildObject('ACCTTAB.FORMS.DOWNLOADPREFILLEDFORM.GET')` is defined from the above code

0 个答案:

没有答案