title: How to download and display text and png files in AngularJS?
body: <p>I have text and image files stored on a server that I need to download and present in an html web page.  I'm using AngularJS to render the page.  If I acquire the files using the code below, then I get an http 200 status response, but the file is not in the body or any where else in the response.  If i enter the exact same URI in my FireFox browser, I get the standard prompt to save the file locally, so I know the uri works.</p>
  
  <p>How do I acquire it in AngularJS?  When I get it, how do I display them?</p>
  
  <pre><code>app.controller('MainController', function($scope, dataService) {
      $scope.data = null;
      dataService.getData().then(function(dataResponse) {
          $scope.data = dataResponse;
      });
  });
  
  app.service('downloadService', function($http) {
      delete $http.defaults.headers.common['X-Requested-With'];
      this.getData = function() {
          console.log("getting data");
          return $http({
              method: 'GET',
              url: 'https://someAddress.com/pathtofile.txt?securitykey=fakeKey',
              params: '',
              headers: {}
          });
      }
  });
  </code></pre>
  
  <p>-- Update --</p>
  
  <p>As per the comment below, I updated the code to the following, but I only see an icon place holder for the image, not the image itself.</p>
  
  <pre><code>var app = angular.module('MyTutorialApp',[]);
  
  app.controller("MainController", function($scope){
      $scope.path_to_image = "https://someAddress.com/pathtofile.png?securitykey=fakeKey"
  });
  
  &lt;div id='content' ng-app='MyTutorialApp' ng-controller="MainController"&gt;
      &lt;img ng-src="path_to_image"&gt;
  &lt;/div&gt;
  </code></pre>