Created
August 13, 2013 06:50
-
-
Save kokeroulis/6218481 to your computer and use it in GitHub Desktop.
This file contains 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
Assertion failed: an Ember.CollectionView's content must implement Ember.Array. You passed function () { | |
var sbList = Ember.Array(); | |
this.channels.forEach(function(c) { | |
sbList.pushObject(ChannelsModel.find(c.id)); | |
}); | |
return sbList; | |
} application.js:727 | |
Uncaught TypeError: Object function () { | |
var sbList = Ember.Array(); | |
this.channels.forEach(function(c) { | |
sbList.pushObject(ChannelsModel.find(c.id)); | |
}); | |
return sbList; | |
} has no method 'addArrayObserver' |
This file contains 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.Array(); | |
this.channels.forEach(function(c) { | |
sbList.pushObject(ChannelsModel.find(c.id)); | |
}); | |
return sbList; | |
} | |
}) | |
}); | |
}, | |
setupController: function(controller, model) { | |
controller.set('channels', model.get('channels')); | |
controller.set('subChannels', model.get('subChannels')); | |
} | |
}); | |
module.exports = ChannelsRoute; |
This file contains 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 ChannelModel = Ember.Object.extend({}); | |
ChannelModel.reopenClass({ | |
find: function(channelId) { | |
utils.get('channel/' + channelId, function(response) { | |
return ChannelModel.create(response); | |
}); | |
} | |
}); | |
module.exports = ChannelModel; |
This file contains 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 = Ember.Object.extend({}); | |
ChannelsModel.reopenClass({ | |
findAll: function() { | |
var channels = Ember.A(); | |
//var channels = []; | |
var promise = Ember.Deferred.create(); | |
utils.get('channels', function(response) { | |
response.channels.forEach(function(c, index) { | |
channels.pushObject(ChannelsModel.create(c)); | |
if(index === channels.length -1) { | |
promise.resolve(channels); | |
} | |
}) | |
}); | |
return promise; | |
} | |
}); | |
module.exports = ChannelsModel; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment