我正在通过API发出GET请求。在邮递员中,如果我单击“发送并下载”,它将起作用。现在,在我的应用程序上,如果我点击单击该API,它将不会下载并允许用户打印。
这是我对get request API的设置:
getPdf() {
const payload = {aplicantId: this.applicantIdHeader, commentCodes:
this.commentCodeHeader, genderType: this.gender, data: this.data }
console.log('THIS IS THE DATA PAYLOAD PASSED IN ', payload)
this.studentService.getPdfConfirmationView(payload).subscribe(
(pdfResponse: any) => {
console.log('PDF RESPONSE: ', pdfResponse)
})
}
要做到这一点,当用户单击按钮调用API时,它应该自动下载并允许他们打印响应。
我不能使用任何外部库或软件包,所有这些都必须通过Angular 7完成。