I have a little problem. I'm using backbone.js. I wrote this code like in example:
<script>
$(document).ready(function () {
window.App = {
Views: {},
Models: {},
Collections: {}
}
App.Collections.Users = Backbone.Collection.extend({
model: App.Models.User,
url: 'service'
});
App.Models.User = Backbone.Model.extend({});
App.Views.App = Backbone.View.extend({
initialize: function() {
console.log( this.collection.toJSON() );
}
});
});
</script>
Than I started server and in browser console type this:
var x =new App.Collections.Users();
x.fetch()
And this follows to error: Uncaught TypeError: Cannot read property 'prototype' of undefined
. But data is present in response. Details in picture. How to fix this?
Thanks for you answers.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…