@aakman wrote:
Hi,
I am new in ionic and I would like to view the details of my next list, but the result REMENE me null. could you help me? thank you.this is my code
var app = angular.module('hotelsApp.controllers', [])app.factory("PromoService", function(){
var promos = [
{
"Hotel":{
"id":"52",
"typeEtablissement":"HOTEL",
"nomHotel":"AUBERGE DES ILES",
"email":"auberge@ghaima.ci",
"siteWeb":null,
"situationGeo":"Assinie",
"nombreChambre":"12",
"commune_id":"21",
"standing_id":"4",
"prixChambreMin":"5000",
"prixChambreMax":"15000",
"tarif":"5 000 \/ 15 000",
"description":"L'auberge des \u00eeles est un lieu paisible et reposant situ\u00e9 \u00e0 Assinie. Un cadre tout aussi propice \u00e0 l'\u00e9vasion et au loisir, vous accueille pour des s\u00e9jours \u00e0 court moyen et long terme.",
"typePaiement":"",
"autreinfo":"",
"logo":"\/img\/hotels\/52\/logo.jpg",
},
"Commune":{
"id":"21",
"libelle":"Assinie"
},
"Standing":{
"id":"4",
"nbEtoiles":"2",
"libelle":"2 Etoiles"
},
"Service":[
{
"id":"6",
"libelle":"Bar",
"Servicehotel":{
"id":"1360",
"hotel_id":"52",
"service_id":"6"
}
}
]
}
];return {
GetPromos: function(){
return promos;
},
GetPromo: function(promoId){
for(var j = 0; j < promos.length; j++) {
if (promos[j].id === parseInt(promoId)) {
return promos[j];
}
}
return null;
}
}});
app.controller('PromosCtrl', function($scope, PromoService) {
$scope.promos = PromoService.GetPromos();
});app.controller('PromoCtrl', function($scope, $stateParams, PromoService) {
promoId = $stateParams.promoId;
$scope.promos[Hotel] = PromoService.GetPromo(promoId);
});
Posts: 1
Participants: 1