Skip to content

Instantly share code, notes, and snippets.

@zzarcon
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zzarcon/0d5a2dbc9650b79c7a8a to your computer and use it in GitHub Desktop.
Save zzarcon/0d5a2dbc9650b79c7a8a to your computer and use it in GitHub Desktop.
Route dependencies
App.FooRoute = App.Route.extend({
dependencies: ['session.team.championship', 'session.team.teamReport', 'customDependency','position', 'user:12345', 'lineup:cached'],
customDependency: function() {
return new Ember.RSVP.Promise();
}
});
@zzarcon
Copy link
Author

zzarcon commented Oct 20, 2014

By this way we can load route dependencies in a more semantic and easy way.

The array of dependencies admits:

-Properties of the object: session.team.championship, session.team.teamReport or customDependency

-Ember data models: positions

-Models with id: user:12345 where 12345 is the id of the user

-Use of cachedFind method: lineup:cached

@fernandodrumond
Copy link

I like this approach to load dependencies! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment