Estou conseguindo ler o meu backend, mas não consigo mostrar os dados em minha view, o que posso estar fazendo de errado?
Em meu controller fiz o seguinte, sendo que já de inicio pedi pra ler meu backend:
.controller("restaurantesCtrl", function($scope,$state,$ionicScrollDelegate,$http,$stateParams,$timeout,$ionicLoading,$ionicPopup,$ionicPopover,$ionicSlideBoxDelegate,$ionicHistory,ionicMaterialInk,ionicMaterialMotion){
$scope.restaurants = [];
$http.get('http://nhac.esy.es/lista_restaurantes.php')
.success(function(restaurants){
$scope.restaurants = restaurants;
console.log("Leu");
})
.error(function(erro){
console.log(erro);
console.log("não leu")
});
$scope.scrollTop = function(){
$ionicScrollDelegate.$getByHandle("top").scrollTop();
};
// open external browser
$scope.openURL = function($url){
window.open($url,"_system","location=yes");
};
// open AppBrowser
$scope.openAppBrowser = function($url){
window.open($url,"_blank","closebuttoncaption=Done");
};
// open WebView
$scope.openWebView = function($url){
window.open($url,"_self");
};
// Set Motion
$timeout(function(){
ionicMaterialMotion.slideUp({
selector: ".slide-up"
});
}, 300);
// animation readmore
var fetchItems = function() {
for(var z=0;z<fetch_per_scroll;z++){
if (angular.isObject(data_restaurantes[lastPush])){
$scope.restaurantes.push(data_restaurantes[lastPush]);
lastPush++;
}else{;
$scope.noMoreItemsAvailable = true;
}
}
$scope.$broadcast("scroll.infiniteScrollComplete");
};
// event readmore
$scope.onInfinite = function() {
$timeout(fetchItems, 200);
};
// create animation fade slide in right (ionic-material)
$scope.fireEvent = function(){
ionicMaterialMotion.fadeSlideInRight();
ionicMaterialInk.displayEffect();
};
// animation ink (ionic-material)
ionicMaterialInk.displayEffect();
$scope.rating = {};
$scope.rating.max = 5;
$scope.ratingsObject = {
iconOn : 'ion-ios-star',
iconOff : 'ion-ios-star-outline',
iconOnColor: 'rgb(200, 200, 100)',
iconOffColor: 'rgb(200, 100, 100)',
rating: 2,
minRating:1,
callback: function(rating) {
$scope.ratingsCallback(rating);
}
};
$scope.ratingsCallback = function(rating) {
console.log('Selected rating is : ', rating);
};
})
Na minha view fiz o seguinte:
<ion-view view-title="Restaurantes" hide-nav-bar="false" >
<ion-content delegate-handle="top" lazy-scroll id="page-restaurantes" class="has-header page-restaurantes" >
<ion-refresher pulling-text="Role para atualizar..." on-refresh="doRefresh()"></ion-refresher>
<ion-list class="card list">
<div class="item item-input">
<i class="icon ion-search placeholder-icon"></i>
<input type="search" ng-model="q" placeholder="Procurar" aria-label="filter promoess" />
</div>
</ion-list>
<div class="list" ng-controller="restaurantesCtrl" ng-repeat="r in restaurants track by $index">
<a class="item item-thumbnail-left" href="#/nhaac/restaurante_singles/">
<img src="/img/logo_restaurante.jpg">
<h2>Nome do Restaurante {{r.fantasia}} </h2>
<h3>Bairro {{r.bairro}} </h3>
<i><rating ng-model="contato.stars" max="rating.max"></rating></i>
<p>Aqui a descrição do restaurante.</p>
<button class="button button-block button-royal">
VER AS PROMOÇÕES
</button>
</a>
</div>
<ion-list class="list">
<div class="item" ng-if="results.length == 0" >
<p>Nenhum resultado encontrado...</p>
</div>
</ion-list>
</ion-content>
</ion-view>