KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to figure out how to make a Collection of collections with backbone.js. I'm pretty new to backbone. I have something like the following situation: +---------------+ +------------------+ | Playlists | | Playlist | |---------------| 0..* |------------------| | +-------------->| Name | | | | | | | | | +---------------+ +-------+----------+ | | |0..* v +------------------+ | Track | |------------------| | Name | | Artist | | | +------------------+ In code this looks similar to this: var trackModel = Backbone.Model.extend({ //trackdata }); var playlistModel = Backbone.Collection.extend({ model : trackModel, url : "playlist" }); var playlistsModel = Backbone.Collection.extend({ url : "playlists", model : playlistModel //This pretty sure doesn't work like I want, because there is no model attribute for collections :S }); However I always receive an error in the js console saying: Uncaught TypeError: Object [object Object] has no method '_validate' when I try to execute a function that triggers the validate (like add, fetch, ...) It makes no difference if i add the validate or _validate function to any of the collections or models. I believe this is because backbone.js
Tags (comma-separated)
Save Edits
Cancel