Answer the question
In order to leave comments, you need to log in
How to customize display of model list in emberjs?
Hello.
I'm trying to display multiple lists of models on a page.
route/index.js
export default Ember.Route.extend({
model() {
return Ember.RSVP.hash({
model1: this.store.queryRecord('model1', { filter: { parent: '' } }),
model2: this.store.query('model2', { filter: { open: true }})
});
}
}
template/index.hbs
{{test-component name=model.model1.name model_id=model.model1.id}}
{{#each model.model2 as |model2t|}}
<p>{{ model2t.text }}</p>
{{/each}}
model2.set('open', true);
Answer the question
In order to leave comments, you need to log in
Your route makes a request and outputs server-prepared data. The promise itself does not keep track of the repository.
In previous versions of ember-data, store had a filter method that filtered data from the server and watched the models update when needed, which is exactly what you want. Now this method has been moved to a separate addon ember-data-filter .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question