2

I'm trying to download a file using an ANGULAR based app, but the file which can be read by HTML 5 are shown in the browser instead of being downloaded. Most of the provided solution online are related to HTML/PHP programming, but they are not helpful in the case of ANGULAR. The code which I'm using is as following:

html:

<button  (click)="download()">Download!</button>

typescript:

download(){
    window.open('http://localhost/test/uploads/file.mp4');
}

Any suggestions? Thanks in advance.

Lim
  • 41
  • 3
  • does this help? https://stackoverflow.com/questions/52154874/angular-6-downloading-file-from-rest-api – GreyBeardedGeek Jun 04 '20 at 16:47
  • @GreyBeardedGeek, Concerning the typescript part (front end) it may be helpful, but the back end part (I think the java was used for it) is very ambiguous to me. Is there a similar case with php? – Lim Jun 06 '20 at 09:53

0 Answers0