I have a Backbone collection something like the following:
var FooCollection = Backbone.Collection.extend({
model:Foo,
initialize: function (attributes,
I was experiencing the same problem. My problem was I had included my Model script after Collection Script:
<script src="scripts/collections/Classes.js"></script>
<script src="scripts/models/Class.js"></script>
To fix it I just had to move the Class.js up above Classes.js:
<script src="scripts/models/Class.js"></script>
<script src="scripts/collections/Classes.js"></script>
Cheers
In my actual code Foo
was declared after FooCollection
. Didn't realize that Javascript doesn't support forward declarations. [headdesk]