Hi,
I’d like to load different models according to the set user preferences… The user has them defined as “modules” via hasMany… I just don’t know how to conditionally load this modules (multiple different model loads). So multiple models which are conditionally defined in a route and the conditionally show in the template.
I’d like to use this in a “dashboard” page… where i would show an overview from different modules… so basically making the same query as I’m using for the model index (just with limit record set).
I’m using ember 2.2 with ember-data 2.3 and ember-simple-auth 1.0.0
Thank you!
Do you mind including relevant code you have currently?
Well, I really don’t have any code to share… I was just prototyping with this:
export default Ember.Route.extend({
model() {
return Ember.RSVP.hash({
posts: this.store.findAll('post'),
tags: this.store.findAll('tag'),
category: this.store.findAll('category'),
weather: this.get('weather').current()
});
},
setupController(controller, models) {
controller.set('posts', models.posts);
controller.set('tags', models.tags);
controller.set('categories', models.categories);
controller.set('weather', models.weather);
}
});
from: http://emberigniter.com/load-multiple-models-single-route/
But I really can’t do this dynamically for different modules (from different users).
BR