angularjs2 mysql_angularjs + ionic + php mysql(undefined不是函数)(angularjs + ionic + php mysql (undefin...
I am trying to load some simple data from db using ionic + angularjs in Intel XDK. I created the theme with http://creator.ionic.io
So, there is a controller.js file controlling every "page". I have a home page and the controller manages it with the code below where I am trying to write the code to bring me the data from the db following http://www.w3schools.com/angular/angular_sql.asp directions.
.controller('homeCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $http) {
$http.get("http://localhost/project/select-audiencia.php").then(function(response){
$scope.audiencia = response.data.records;
});
/*$scope.Number = 0;
$scope.test = function(){
return $scope.Number += 1;
}*/
}])
.controller('suporteCtrl', ['$scope', '$stateParams', // The following is the constructor function for this page's controller. See https://docs.angularjs.org/guide/controller
// You can include any angular dependencies as parameters for this function
// TIP: Access Route Parameters for your page via $stateParams.parameterName
function ($scope, $stateParams) {
}])
I am getting undefined is not a function in $http.get() line. Php file is fine and returning json code.
$sql = $mysqli->query("SELECT * FROM audiencia");
if($sql->num_rows > 0){
while($row = $sql->fetch_array(MYSQL_BOTH)){
$registro = array(
"ID" => $row['id'],
"VOU" => $row['vou'],
"NAO_VOU" => $row['nao_vou'],
"TALVEZ" => $row['talvez']
);
$retorno[] = $registro;
}
}
$mysqli->close();
$retorno = json_encode($retorno);
echo $retorno;
What is the problem with that function?
UPDATE

Comparecerão:
{{x.VOU}}
vao - nao vao - talvez
更多推荐

所有评论(0)