title: How to download .xls file with angularjs sent with readAllBytes
body: <p>I have in my backend application an spray route that pushes out a .xls file using </p>
  
  <p><code>FileUtils.readAllBytes(xlsFile)</code></p>
  
  <p>In my frontend application I'm using angularjs with Restangular module so I need to receive my .xls file and download it to user's computer.</p>
  
  <p>I have in my code</p>
  
  <pre><code>Restangular.one("localhost:9090/excel")
          .get()
          .then(function(response){
              alert("Excel is here!");
              var hiddenElement = document.createElement('a');
              hiddenElement.href = 'data:attachment/xls,' + encodeURIComponent(response);
              hiddenElement.download = 'reporte-anual.xls';
              hiddenElement.click();
          });
  </code></pre>
  
  <p>but it only does the alert.</p>
  
  <p>How can I achieve that?</p>
  
  <p>Thank you all</p>