title: angularJS - Unable to load API Json response data into my HTML file
body: <p>Here is the code that I am using:</p>
  
  <pre><code>angular.module('ngApp', [])
  .factory('authInterceptor', authInterceptor)
  .constant('API', 'http://myserver.com/app/api')
  .controller('task', taskData)
  
  function taskData($scope, $http, API) {
    $http.get( API + '/tasks' ).
    success(function(data) {
      $scope.mainTask = data;
      console.log(data);
    });
  }
  </code></pre>
  
  <p>Here is my HTML file:</p>
  
  <pre><code>&lt;html&gt;
  
    &lt;head&gt;
      &lt;title&gt;PCC ECAR App&lt;/title&gt;
  
      &lt;link href="../app.css" rel="stylesheet" /&gt;
    &lt;/head&gt;
  
    &lt;body ng-app="ngApp" ng-controller="task" class=""&gt;
  
      &lt;div class="view1"&gt; {{mainTask.Amount} &lt;/div&gt;
  
      &lt;!-- Third Party Scripts --&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.7/angular.min.js"&gt;&lt;/script&gt;
  
      &lt;!-- Main App Script --&gt;
      &lt;script src="../app/app.js"&gt;&lt;/script&gt;
  
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is a screenshot of the console log from the API response:</p>
  
  <p><a href="https://i.stack.imgur.com/PV8tV.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PV8tV.jpg" alt="enter image description here"></a></p>
  
  <p>What is happening is when you go to the page, the element <code>view1</code> will show <code>{{mainTask.Amount}}</code> for a half a second and then disappear leaving the element blank. I am obviously doing something wrong. Why cant I load the data into the HTML?</p>