title: Getting data from database to angular js
body: <p>I'm new to Angular JS and I've been learning from codeschool. </p>
  
  <p>I have this problem i can't figure out how to solve: I want to get data from a PHP file that I'm working on but first I wanted to make a short example because something just doesn't make sense to me, and is that can never retrieve the information that has the PHP file to the angular controller.</p>
  
  <p>I have uploaded it on a <strong><a href="http://jsfiddle.net/jcguarinpenaranda/azT5q/8/" rel="nofollow noreferrer">jsfiddle</a></strong> you can check out if you want. </p>
  
  <p>Here's the html, it's pretty basic:</p>
  
  <pre><code>&lt;div ng-app="app"&gt;
      &lt;div ng-controller="MyController as c"&gt;
           &lt;h1&gt;{{c.title}}&lt;/h1&gt;
          &lt;p&gt;Controller trial: {{c.content}}&lt;/p&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And here the JavaScript source:</p>
  
  <pre><code>var app = angular.module("app", []);
  app.controller("MyController", ['$http', function ($http) {
      this.title = "My Title";
      var filecontent = "Data should be replaced";
      $http.get("http://www.otherwise-studios.com/example.php")
          .success(function (data) {
              filecontent = data;
              //I don't know why data is not loaded here :S
          });
      this.content = filecontent;
  }]);
  </code></pre>
  
  <p>Finally, this is the output i'm getting:</p>
  
  <pre><code>My Title
  
  Controller trial: Data should be replaced
  </code></pre>
  
  <p>If you visit the <strong><a href="http://www.otherwise-studios.com/example.php" rel="nofollow noreferrer">link</a></strong> from which i'm retrieving the information you should see this output "You connected to my PHP file", but as i said before, the data seems to never get updated to the variable:</p>
  
  <pre><code>this.content
  </code></pre>
  
  <p>Thank you so much for all your help!</p>
  
  <p>Juan Camilo Guarin P</p>