I have a controller which looks like that:
app.controller('DealCtrl', function($scope, Deals) {
Deals.all().then(function (deals) {
$scope.deals = deals;
console.log($scope.deals);
});
});
And a services.js like this:
var app = angular.module('starter.services', []);
app.factory('Deals', function($http) {
function getDeals() {
return $http.get('http://www.domain.com/library/fct.get_deals.php')
.success(function (data) {
var deals = data;
return deals;
})
.error(function(err){
});
}
return {
all: function() {
return getDeals();
},
get: function(keyID) {
//...
}
}
});
It gets an object from my server with the following structure:
[
{
id: "1",
category: "...",
title: "...",
...
},
{ ... }
]
The problem is, I'm not able to output the title attribute in my index.html. I want to do it in the following manner:
...
<ion-content ng-repeat="deal in deals">
<div class="list card">
<div class="item item-avatar">
<img src="img.jpg">
<h2>{{deal.title}}</h2>
<p>Text</p>
</div>
</div>
</ion-content>
...
It just displays nothing. What am I doing wrong?