Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4838

Correct way to load multiple data sources?

$
0
0

@joshhornby wrote:

I have a question about the correct way to structure an Ember application. So I have an application/edit/{id} route, my model currently looks like this:

  model(params) {
    return this.store.findRecord('app', params.application_id);
  }

On this application page I also want another section/view/component (I am not sure on the correct ember term) which will display some other data from the API - for example api/application/{id}/foo Would this be the correct way to do it:

  model(params) {
    return RSVP.hash({
      'application': this.store.findRecord('app', params.application_id),
      'foo': this.store.findRecord('foo', params.application_id),
    });
  }

And then in the edit template I can create a component and just pass the data into this? Or is there a better way than just adding to the RSVP.hash object? What happens if I don't want to block rendering waiting for all model hooks to complete?

I am correct in saying components loading data is bad practice?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4838

Trending Articles