Backbone.js Collection of Collections
You'd solve your problem by turning your Playlist
from a collection into a model. If you think about it, a Playlist
would probably have other attributes anyway (e.g. name) that wouldn't be settable on a collection.
Playlists
would then be a collection of Playlist
models (instead of collections), which should work without error.
var Track = Backbone.Model.extend({
//trackdata
});
var Playlist = Backbone.Model.extend({
model : Track
});
var Playlists = Backbone.Collection.extend({
url : "playlists",
model : Playlist
});