Last active
December 20, 2015 23:18
-
-
Save alexspeller/6210957 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var utils = require('../utils.js'); | |
| var ChannelsModel = require('../models/channels.js'); | |
| var ChannelModel = require("../models/channel.js"); | |
| var ChannelsRoute = Ember.Route.extend({ | |
| model: function() { | |
| return ChannelsModel.findAll().then(function(result){ | |
| return Ember.Object.create({ | |
| channels: result, | |
| subChannels: function() { | |
| var sbList = Ember.A(); | |
| this.channels.forEach(function(c) { | |
| sbList.pushObject(ChannelModel.find(c.id)); | |
| }); | |
| return sbList; | |
| } | |
| }); | |
| }) | |
| }, | |
| setupController: function(controller, model) { | |
| controller.set('channels', model.channels()); | |
| controller.set('subChannels', model.subChannels()); | |
| } | |
| }); | |
| module.exports = ChannelsRoute; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment