title: How to write an angularJs Controller to GET Rest Data from Parse.com
body: <p><strong>See solution below:</strong></p>
  
  <p>I'm trying to connect to a Parse.com Rest backend and display data from object values.</p>
  
  <p>HTML (I put several angular calls to be sure to catch output):</p>
  
  <pre><code>&lt;div ng-controller="MyController"&gt;
      &lt;p&gt;{{item}}&lt;p&gt;
      &lt;p&gt;{{items}}&lt;p&gt;
      &lt;p&gt;{{item.firstName}}&lt;p&gt;
      &lt;p&gt;{{data}}&lt;p&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>JAVASCRIPT rest:</p>
  
  <pre><code>function MyController($scope, $http) {
  
      $scope.items = [];
      $scope.getItems = function() {
  
          $http({method : 'GET',url : 'https://api.parse.com/1/classes/Professional/id', headers: { 'X-Parse-Application-Id':'XXXX', 'X-Parse-REST-API-Key':'YYYY'}})
              .success(function(data, status) {
                  $scope.items = data;
              })
              .error(function(data, status) {
                  alert("Error");
              });
      };
  }
  </code></pre>
  
  <p>This won't work, it does strictly nothing, not even a message in the console.
  I know the rest call got the correct credential, as I'm able to get object content returned when I test it with a rest tester program. Maybe the URL should not be absolute ?
  Any clue is very welcome, i've spent DAYS on that.</p>
  
  <p><strong>SOLUTION:</strong></p>
  
  <p>Thanks to the help of people answering this thread, I was able to find the solution to this problem so I just wanted to contribute back:</p>
  
  <p>Get Json object data from Parse.com backend, pass it authentification parameters:</p>
  
  <pre><code>function MyController($scope, $http) {
  
      $scope.items = [];
      $scope.getItems = function() {
  
          $http({method : 'GET',url : 'https://api.parse.com/1/classes/Professional', headers: { 'X-Parse-Application-Id':'XXX', 'X-Parse-REST-API-Key':'YYY'}})
              .success(function(data, status) {
                  $scope.items = data;
              })
              .error(function(data, status) {
                  alert("Error");
              });
      };
  </code></pre>
  
  <p>Notice that ' ' necessary arround header key object values. Those ' ' are not necessary around method and url keys.</p>
  
  <p>Template that list all 'firstName' of each object:</p>
  
  <pre><code>&lt;div ng-controller="MyController" ng-init="getItems()"&gt;
       &lt;ul&gt;
          &lt;li ng-repeat="item in items.results"&gt; {{item.firstName}} &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Notice: "item in items.results". "results" is necessary because the return value is a JSON object that contains a results field with a JSON array that lists the objects. This could save you some headache.
  Also notice "ng-init": if you don't put that, or any other form of call to the getItem(),then nothing will happen and you will be returned no error.</p>
  
  <p>That was my first try of Angularjs, and i'm already in love ^^.</p>