samedi 2 avril 2016

How to handle more than one model into a template/route in ember.js

I'm new to Ember and I would like to know which is the best practice to handle this common scenario.

I would like to display inside the index page a form for creating some model, and after that show 4 nodes with little-info about the last 4 of that model store.

So, my first idea was something like:

app/index/template.hbs (im using pod's)

...
<div> 
   {{form-creator-component o=model}}}
</div>
<div>
   <h3>Last 4</h3>
   {{#each model2 as |element| }}
      {{litle-info o=element }}
   {{\each}}
</div>
.....

But for doing that, I would need to have 2 models in the same template (and route), which looks kind of weird and I've seen nowhere in docs nor in guides. So, I assume I'm doing something in the wrong way :)

Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire