title: AngularJS make REST call and display result in browser
body: <p>I'm trying to get data from a REST service and display the elements in the browser.
  Piece of code:</p>
  
  <pre><code>Server.prototype.typeNames = function() {
                  var json = '{'
                          + '"query" : "MATCH n RETURN n.typeName LIMIT 10"'
                          + '}';
                  $http.post("http://localhost:7474/db/data/cypher", json).then(function(response) {
                      var data = response.data;
                      console.log(data);
                      return data;
                  });
              }
  </code></pre>
  
  <p>I'm sure the JSON and the REST call are correct because I can see the data in my console and it's correct but I can't see it on the page.
  I have also this in my js file:</p>
  
  <pre><code>$scope.typeNames = Server.typeNames()
  </code></pre>
  
  <p>In HTML:</p>
  
  <pre><code>{{typeNames}}
  </code></pre>
  
  <p>Also: I install AngularJS debug extension for chrome and there it's also null:</p>
  
  <pre><code>typeNames: null
  </code></pre>
  
  <p>Here (<a href="http://pastebin.com/itHv97da" rel="nofollow">http://pastebin.com/itHv97da</a>) you can find a bigger part of code. This code is not mine, the Server.prototype things were all there. I just added the Server.prototype.typeNames and I'm trying to get it to work.</p>