Skip to content

Instantly share code, notes, and snippets.

@nickiaconis
Created October 14, 2015 21:38
Show Gist options
  • Save nickiaconis/2caab6bbdb8f6e4c5a74 to your computer and use it in GitHub Desktop.
Save nickiaconis/2caab6bbdb8f6e4c5a74 to your computer and use it in GitHub Desktop.
Route#resolveModelLater & Route#asyncModelFor
App.PostRoute = Ember.Route.extend({
model(params) {
const promise = this.store.findRecord('post', params.id);
this.resolveModelLater(promise);
}
});
App.PostCommentsRoute = Ember.Route.extend({
model(params, transition) {
this.resolveModelLater(Ember.RSVP.hash({
OP: this.asyncModelFor('post').then((post) => post.author),
comments: this.store.findAll('comments', transition.params.post.id)
}));
}
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment