title: GET json data from a php file for an Angular scope
body: <p>I'm trying to get json data from a php file to use within an Angular controller. Im echoing <code>json_encode(pg_fetch_assoc($result));</code> within the php file and when I <code>console.log($scope.contents);</code> in the angular controller it brings back the json data, but it comes back empty when I try doing an <code>ng-repeat</code></p>
  
  <p><strong>controllers.js</strong>:</p>
  
  <pre><code>myApp.controller('ContentCtrl', function ($scope, $http) {
    $http({method: 'GET', url: 'content.php'}).success(function(data) {
      $scope.contents = data;
    });
  });
  </code></pre>
  
  <p><strong>content.php</strong>:</p>
  
  <pre><code>&lt;?php
  require_once("sdb.php");
  $result = pg_query($dbconn, "SELECT * FROM content ORDER BY name ASC");
  echo json_encode(pg_fetch_assoc($result));
  </code></pre>
  
  <p><strong>index.php</strong>:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;link rel="stylesheet" href="css/style.css"/&gt;
  &lt;/head&gt;
  &lt;body ng-app="myApp"&gt;
   &lt;div ng-controller="ContentCtrl"&gt;
     &lt;ul&gt;
       &lt;li ng-repeat="content in contents"&gt;
         &lt;a href="#"&gt;{{content.name}}&lt;/a&gt;
       &lt;/li&gt;
     &lt;/ul&gt;
   &lt;/div&gt;
  &lt;/body&gt;
     &lt;script src="js/jquery-1.10.2.js"&gt;&lt;/script&gt;
     &lt;script src="js/angular.min.js"&gt;&lt;/script&gt;
     &lt;script src="js/controllers.js"&gt;&lt;/script&gt;
  &lt;/html&gt;
  </code></pre>