网页文件
<button mat-button (click) = "FileDownload">Download</button>
角四分量法
FileDownload()
{
this.filePath = "D:\SamplePDF.pdf";
document.loation.href = this.filePath;
}
在这里,我想在单击按钮时下载本地文件。我无法下载该文件。请帮忙。
PS:我也无法访问 window.open() 因为我正在使用 angular 4 应用程序。
原文由 Billy 发布,翻译遵循 CC BY-SA 4.0 许可协议
你能试试这个片段吗