TLDR, question at the bottom. I solved my issue, but after typing all this up, still thought I'd throw out the underlying question
For anyone looking into this error, here's the description/solution:
I'm getting an error when trying to add a View to a Collection:
Uncaught TypeError: Object [object Object] has no method '_validate'
I solved my problem:
I was defining my collection to use a Model that was really a View:
ViewCollection = Backbone.Collection.extend({ model: MyView });
MyView was an instance of Backbone.View
, not a model, duh.
Conceptual Question:
Is it OK to use a Backbone.Collection
instead of an array
or object
, to store things, like a Backbone.Collection
of Backbone.Views
, or any generic array of objects? If my model has multiple views, is it common to store them like so:
model
collectionOfViews
view
view
view