title: How to convert xhr request to angular $http request?
body: <p>I am trying to load image via <code>ajax</code>by the following code which is already Working . I am trying to convert it into angular <code>$http</code> and it doesn't work.</p>
  
  <p><strong>Plain ajax code</strong></p>
  
  <pre><code>var xhr = new XMLHttpRequest();
  xhr.open('GET', attr.imageUrl, true);
  xhr.responseType = 'blob';
  xhr.onload = function(e) {
      element[0].src = window.URL.createObjectURL(this.response);
  };
  
  xhr.send();
  </code></pre>
  
  <p><strong>Angular Code</strong></p>
  
  <pre><code>$http.get(attr.imageUrl, {}, {
      responseType: 'arraybuffer'
  })
  .success(function(response) {
      var file = new Blob([response]);
      element[0].src = URL.createObjectURL(file);
  });
  </code></pre>