I use AngularJs and I need to return a data after a $http.post connection. This is the 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
}
OLD: How can I pass the data into myData? - Thanks for your answers and sorry if I haven't explained well.
But now, in html, {{myData}} what can I write?
I do not know if it's fundamental, but I'll have to use "myData" with an "ng-if"..
EDIT: Thanks! I think that I've solved! :D
this.myData or $scope.myDatanot both