title: AngularJS - Return in success $http.post
body: <p>I use AngularJs and I need to return a data after a $http.post connection. This is the code:</p>
  
  <pre><code>app.controller('PrincipalController',['$http', '$scope', function($http,$scope){
    $scope.myData = 0;
    $http.post("server/checklogin.php",
      {id: "id",email: "email",password: "password"}
    )
    .success(function(data){
      console.log($scope.myData) //0
      $scope.myData = data;
      console.log($scope.myData); // 1
  }
  </code></pre>
  
  <p>OLD: How can I pass the data into myData? - Thanks for your answers and sorry if I haven't explained well.</p>
  
  <p>But now, in html, <code>{{myData}}</code> what can I write?</p>
  
  <p>I do not know if it's fundamental, but I'll have to use "myData" with an "ng-if"..</p>
  
  <p>EDIT: Thanks! I think that I've solved! :D</p>