Skip to content

Instantly share code, notes, and snippets.

@jkarsrud
Last active January 4, 2016 05:59
Show Gist options
  • Save jkarsrud/8578967 to your computer and use it in GitHub Desktop.
Save jkarsrud/8578967 to your computer and use it in GitHub Desktop.
App.Router.map(function() {
this.resource('channels', {path: '/'}, function() {
this.resource('events', {path: '/:channel_id/events'});
});
});
App.ChannelsRoute = Em.Route.extend({
model: function() {
return this.store.find('channels');
}
});
App.EventsRoute = Em.Route.extend({
model: function(params) {
var channel = this.store.find('channels', param.channel_id);
var events = this.store.find('events', param.channel_id);
return Ember.RSVP.hash({
channel: channel,
events: events
});
},
setupController: function(controller, model) {
controller.set('content', model);
controller.set('channel', model.channel);
controller.set('events', model.events);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment