title: Excel download is not working in MEAN stack app
body: <p>I want to download the excel file when i click the button.</p>
  
  <p>When i click the download button, I want to create a Excel file with dynamic data from data base and download it (Note: Don't want to create and store the excel file into physical path and then download it).</p>
  
  <blockquote>
    <p>Html Code</p>
  </blockquote>
  
  <pre><code>&lt;button ng-click="exportData()" class="btn btn-sm btn-primary btn-create"&gt;Download&lt;/button&gt;
  </code></pre>
  
  <blockquote>
    <p>Controller Code</p>
  </blockquote>
  
  <pre><code> $scope.exportData = function () {
       $http.get('/Getexcel').then(function (response) {
       });
   };
  </code></pre>
  
  <blockquote>
    <p>Server code</p>
  </blockquote>
  
  <pre><code> const ExcelConfig = require('./public/Models/Schema/excel');
      app.get('/Getexcel', ExcelConfig.getexceldata);
  </code></pre>
  
  <blockquote>
    <p>note :
    ExcelConfig contain path of schema code</p>
    
    <p>excel.js code</p>
  </blockquote>
  
  <pre><code>// Require library 
  var xl = require('excel4node');
  const tempfile = require('tempfile');
  
  // Create a new instance of a Workbook class 
  var wb = new xl.Workbook();
  
  // Add Worksheets to the workbook 
  var ws = wb.addWorksheet('MaterialFlowSheet');
  // Create a reusable style 
  var style = wb.createStyle({
      font: {
          color: '#FF0800',
          size: 12
      },
      numberFormat: '$#,##0.00; ($#,##0.00); -'
  });
  
  exports.getexceldata = (req, res) =&gt; {
      ws.cell(1, 1).string('BatchId').style(style);
      ws.cell(1, 2).string('Source').style(style);
      ws.column(2).setWidth(50);
      ws.row(1).setHeight(20);
      ws.cell(1, 3).string('Destination').style(style);
      ws.column(3).setWidth(50);
      ws.row(1).setHeight(20);
      ws.cell(1, 4).string('DistanceBetweenTwoBuilding').style(style);
      ws.column(4).setWidth(25);
      ws.row(1).setHeight(20);
      ws.cell(1, 5).string('SKU').style(style);
      ws.cell(1, 6).string('UOM').style(style);
      ws.cell(1, 7).string('QtyToBeDelivered').style(style);
      ws.column(7).setWidth(20);
      ws.row(1).setHeight(20);
      ws.cell(1, 8).string('CartType').style(style);
  wb.write('Excel.xlsx');
  res.download('\Excel.xlsx');
  };
  </code></pre>
  
  <p>I have tried with above sample file download. So when I click the Download button, the file is not downloading instead nothing happened in UI. But I'm Getting downloaded If I access this URL <code>http://localhost:8080/Getexcel</code>. 
  Can anyone give the solution to download the excel file by clicking the Download button?</p>