title: Angularjs: Displaying array of objects
body: <p>For the life of me I cannot extract and print out the data in my array.  I've generated JSON in PHP and I've wired up Angularjs to retrieve this data.  The Angularjs development tool within Chrome is telling me that I have a variable "user" that is an array of objects (see below) when I run the code.  I made user a rootScope variable "$rootScope.user = data;" so I can get at it.  I'm a newb so none of this is probably best practice.</p>
  
  <pre><code>{ 
      user : [{"user_id":"1","firstname":"John","lastname":"Doe","email":"john.doe@email.com","age":"29","height":"74.5","weight":"200","gender":"M","birthdate":"2013-12-31","username":"john.doe","hash":"$2a$10$MECYLWuu6AwRxzBF\/CUys.AuqVm7Lf4BYRGezeusvLe6wNTkU3FEy"}]
  } 
  </code></pre>
  
  <p>This is the <code>ng-repeat</code> I use on the same page that shows the above "user" is within its scope:</p>
  
  <pre><code>&lt;ul id="biometrics" ng-repeat="info in user"&gt;
       &lt;li&gt;Age: {{info.age}}&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>What am I doing wrong? Perhaps what am I NOT doing wrong.  I'm new to Angularjs to say the least.</p>
  
  <hr>
  
  <p>I tried what was suggested but to no avail. I just want to try and clarify my code/situation just to be sure I didn't screw up.  I think I may have been unclear as this is also my first time posting on StackOverflow.</p>
  
  <p>This is literally what my login.php file returns: </p>
  
  <blockquote>
    <p>[{"user_id":"1","firstname":"John","lastname":"Doe","email":"john.doe@email.com","age":"29","height":"74.5","weight":"200","gender":"M","birthdate":"2013-12-31","photoURL":"john.doe.jpg","username":"john.doe","hash":"$2a$10$MECYLWuu6AwRxzBF/CUys.AuqVm7Lf4BYRGezeusvLe6wNTkU3FEy"}]</p>
  </blockquote>
  
  <p>This is my login controller:</p>
  
  <pre><code>app.controller("LoginController", ['$scope', '$rootScope', '$http', '$location', function($scope, $rootScope, $http, $location) {
      $scope.errorMessage = "Wrong password or username";
  
      $scope.login = function() {
  
          $http({
              url: "./login.php",
                  method: "POST",
                  data: { cache: false, username: $scope.username, password: $scope.password },
                  headers : {'Content-Type':'application/x-www-form-urlencoded; charset=UTF-8'} 
              }).success(function(data, status, headers, config) {
                  $rootScope.user = data;
                  $location.path('/dashboard');
              }).error(function(data, status, headers, config) {
                  $scope.statusMessage = status;
                  alert($scope.errorMessage);
          });
      }
  }]);
  </code></pre>
  
  <p>This is in my view HTML:</p>
  
  <pre><code>&lt;ul id="biometrics" ng-repeat="info in user"&gt;
      &lt;li&gt;Age: {{info}}&lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>I get nothing when I try this and I tried data.user and got nothing.</p>