title: How to prompt save dialog to download file using angularjs?
body: <p>I have a directory in server that contains file now i am sending file name from client and getting the file from server till that part is working good, below is the response from server now once i receive response i want to prompt for user to download that file for that i am trying to create blob using Angularjs but its not prompting for user to save the file. Any idea ?</p>
  
  <p>ctrl.js</p>
  
  <pre><code>$scope.downloadFile = function(message){
          DitFactory.getFile(message).then(function(response){
              console.log('r',response);
              var blob = new Blob([ response ], { type : 'text/plain' });
              $scope.url = (window.URL || window.webkitURL).createObjectURL( blob );
              console.log($scope.url);
          });
      };
  </code></pre>
  
  <p>serverResponse.json</p>
  
  <pre><code>{"level":"info","message":"another-2fdas  message"}
  </code></pre>
  
  <p>server.js</p>
  
  <pre><code>app.get('/file', function (req, res) {
      var dir = './ditLogs';
      var root = path.resolve('./ditLogs');
      var fileName = req.query.file_name;
      var data;
      fs.readdir(dir, function(err, items) {
          items.forEach(function(file){
              if(fileName === file){
                  data = file;
                  res.setHeader('Content-Disposition', 'attachment; filename=' + data);
                  res.sendFile(data, {root: root});
              }
          });
      });
   });
  </code></pre>