Good evening,
I'm trying to fetch php data through Angular.js but it is not working. When I click on the category it does not open the next page where the data will be shown.
PHP
<?php
header('Content-Type: application/json');
require_once("../funcoes/funcoes.php");
$result = $conexao->prepare("SELECT * FROM colecoes WHERE menu = :menu AND activo = :activo ORDER BY pos ASC");
$result->bindValue(':menu', 'Comer', PDO::PARAM_STR);
$result->bindValue(':activo', 1, PDO::PARAM_INT);
$result->execute();
$rows = $result->fetchAll(PDO::FETCH_ASSOC);
foreach ($rows as $row) {
$result_anex = $conexao->prepare("SELECT * FROM colecoes_anexos WHERE id_mae = :row_id AND seccao = :seccao");
$result_anex->bindParam(':row_id', $row['id'], PDO::PARAM_INT);
$result_anex->bindValue(':seccao', 'thumbnail', PDO::PARAM_STR);
$result_anex->execute();
$row_anex = $result_anex->fetch(PDO::FETCH_ASSOC);
echo json_encode($row);
}
?>
Controlller
angular.module('starter.controllers', [])
.controller('comer_categorias', function($scope, $http) {
$http.get("https://www.sabeonde.pt/api/api_categorias_comer.php").success(function (data) {
$scope.comer = data;
});
});
HTML
<ion-content ng-controller="comer_categorias">
<h1 ng-repeat="comer_cat in comer">{{comer_cat.id}}</h1>
</ion-content>