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

XKpA1sK1QMeh5stz2Pe8_logo.png

Comparecerão:

{{x.VOU}}

Vou

Não Vou

Talvez

vao - nao vao - talvez

Fotos e Novidades

Logo

开源鸿蒙跨平台开发社区汇聚开发者与厂商,共建“一次开发,多端部署”的开源生态,致力于降低跨端开发门槛,推动万物智联创新。

更多推荐