Skip to content

Instantly share code, notes, and snippets.

@ryanto
Last active June 12, 2017 22:01
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ryanto/5487b6c8296e4c0c1ad684b0804acd57 to your computer and use it in GitHub Desktop.
Save ryanto/5487b6c8296e4c0c1ad684b0804acd57 to your computer and use it in GitHub Desktop.
// The home page needs to load a lot of data for a feed of events.
// This would block initial rendering of the application, so what
// we do is make a pathless child route called feed that loads the
// data.
// Since our home route doesn't load data anymore it renders
// immediately. It has an {{outlet}}, and while 'home.feed' is
// fetching data 'home.loading' will be rendered into the
// outlet. Once feed's model hook fulfills the feed template
// is rendered to the outlet.
// Our loading template is a skeleton ui of the feed.
// This makes Ember's router give the apperence async
// rendering while still being able to use all the goodies
// in the router.
this.route('home', { path: '/' }, function() {
this.route('feed', { path: ''});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment