title: Download multiple files/documents in the browser
body: <p>I'm trying to figure out how to download many files based upon user selection from a list of files. I'm familiar with the <code>&lt;a href="/images/myw3schoolsimage.jpg" download="w3logo"&gt;</code> download attribute for individual files but the difference in this problem is you select many files from a list then select a download button. Plunker depicted below should illustrate my problem.</p>
  
  <p>I'm trying to figure out in Angular/JQLite how to download a file. I've been reading up on $window but can't seem to get the download to happen.</p>
  
  <p>Plunker:
  <a href="http://plnkr.co/edit/YVE80FPJZXH0lD0li9M8" rel="nofollow">http://plnkr.co/edit/YVE80FPJZXH0lD0li9M8</a></p>
  
  <pre><code>angular.module('app').directive('documentList', function(){
  return {
    templateUrl: 'doclistview.html',
    restrict: 'E',
    scope: {},
    controller: function ($scope, $window) {
      $scope. downloadDocuments = function() {
        getSelectedDocuments();
        _.each($scope.selectedDocuments, function (document){
          //How to download multiple files
          $window.open(document.Template, '_blank', '');
        })
      }
  
      function getSelectedDocuments() {
          $scope.selectedDocuments = _.where($scope.documents, {"selected": true});
      }
  
      //This can really be any file type but I just plucked some images online to simplify.
      $scope.documents = [
          {"FileName": "Cube Image.png", "FileType": "png", "Template": "http://zoarchurch.co.uk/content/pages/uploaded_images/91.png"}
          ,{"FileName": "Dice Roll", "FileType": "jpeg", "Template": "http://nathaningram.com/wp-content/uploads/2011/12/random-image1.jpg"}
          ,{"FileName": "RAWR!!!", "FileType": "jpeg", "Template": "http://images2.fanpop.com/image/photos/8600000/random-animals-animals-8676039-1600-1200.jpg"}
      ]
    }
  }
  </code></pre>
  
  <p>});</p>
  
  <p>I will keep tinkering but any help is greatly appreciated.</p>