title: Unable download image file in angular js
body: <p>Iam trying to download image using angularjs. In postman im getting the output as this format:</p>
  
  <p>锟斤拷锟斤拷JFIF,,锟斤拷xPhotoshop 3.08BIM\gP53616c7465645f5fdfdda5a4f94df34e8d1d8e056e7e5dcc820ce57f793e13bfa39119fdc1b0c079锟斤拷C锟斤拷�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟</p>
  
  <pre><code>&lt;a id="download" ng-click="downloadfile()"&gt;Download FileName&lt;/a&gt;
  </code></pre>
  
  <p>This code for downloading the image.</p>
  
  <pre><code>$scope.downloadfile=function(){
  var download = document.getElementById("download");
  $scope.downloadData =  锟斤拷锟斤拷JFIF,,锟斤拷xPhotoshop 3.08BIM\gP53616c7465645f5fdfdda5a4f94df34e8d1d8e056e7e5dcc820ce57f793e13bfa39119fdc1b0c079锟斤拷C锟斤拷�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟�锟;
  
  download.onclick = function() {
  
    downloadFile("text.jpg", $scope.downloadData);
  }
  
  function downloadFile(filename, text) {
    var pom = document.createElement('a');
    pom.setAttribute('href', 'data:image/jpeg;charset-utf-8,' + encodeURIComponent(text));
    pom.setAttribute('download', filename);
    pom.click();
  }
  }
  </code></pre>
  
  <p>When i download a image i will get invalid image
  Thanks in advance</p>