사용자 도구

사이트 도구


angular:download

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

angular:download [2023/11/16 01:41] – 만듦 taekguangular:download [2025/04/15 10:05] (현재) – 바깥 편집 127.0.0.1
줄 1: 줄 1:
 +====== Download File ======
  
 +<code javascript>
 +import rxjs/Rx;
 +
 +details = {id: 75,name: "some name"}
 +
 +this.nameService.getData(this.details).subscribe(response => {
 +this.downloadFile(response);
 +})
 +
 +downloadFile(data: Response) {
 + let blob = new Blob([data]); 
 + let link = document.createElement('a'); 
 + link.href = window.URL.createObjectURL(blob); 
 + link.download = evt.filename; 
 + link.click(); 
 +}
 +</code>