Hi sorry if the question has already send. I have a problem with setupController hook. I don’t know if I use it correctly or if I make a mistake.
My route methode :
BNNP.IndexRoute = Ember.Route.extend({
model: function() {
return BNNP.Info.find();
},
setupController: function() {
this.controllerFor('photosIndex').set('model', BNNP.Photo.find({valid: true}));
}
});
My template :
<script type="text/x-handlebars" id="index">
{{#view BNNP.NewsView}}
<h3 title="Cliquer pour voir les dernières news" style="cursor:pointer" {{action showNews target="view"}}>Dernières
News</h3>
<div id="news" class="row-fluid">
{{#each info in controller}}
<b>{{info.title}}</b> : {{{info.text}}}<br>
{{else}}
<i>Chargement en cours</i>
{{/each}}
</div>
{{/view}}
<div class="row-fluid">
{{render photos/index}}
</div>
</script>
<script type="text/x-handlebars" id="photos/index">
<ul class="thumbnails">
{{#each photo in controller}}
<li class="span2">
<div>
{{#linkTo photos.byId photo}}<h5 {{action incrementShow}} >{{photo.imageTitle}}</h5>{{/linkTo}}
{{#linkTo photos.byId photo class="thumbnail"}}
<img {{bindAttr src="photo.imageUrl"}} />
{{/linkTo}}
Publiée par : {{photo.author.name}}<br>
Vu {{photo.nbView}} fois. 0 commentaire<br>
</div>
</li>
{{ else }}
<p>Il n'y a pas de photo</p>
{{/each}}
</ul>
</script>
The request BNNP.Photo.find return an empty response => .
When I comment setupController hook, info data are properly load and transmitted to my template. In this case everything works but when I uncomment setupController hook info data are not load or not visible in my template.
When I provide data to photos, photo data are load but always nothing for info data
Is this the right way to load info data and photo data in the same route or in otherwise how I do ?
Thanks a lot in advance for your futur help !