0

I use window.open in my ng-click function to download files. Files can be of type .xls, .pdf, .doc .

Following is the sample code.

$scope.download = function(urls){
        angular.forEach(urls, function (value, key) {
            window.open(value,'_blank');
        });
    }

.xls and .doc files can be downloaded directly.But .pdf files opens in a new tab. Is there any solution?

user3135796
  • 11
  • 1
  • 7
  • 1
    Possible duplicate of [(HTML) Download a PDF file instead of opening them in browser when clicked](http://stackoverflow.com/questions/6794255/html-download-a-pdf-file-instead-of-opening-them-in-browser-when-clicked) – Sumner Evans Jan 07 '16 at 04:09
  • I went through the link provided.But how can I do it from angularjs controller ng-click function? – user3135796 Jan 07 '16 at 04:25
  • You are going to have to do the Content Disposition method. Or you can create a hidden download link and "click" it from the code. – Sumner Evans Jan 07 '16 at 15:29

0 Answers0