Je construis ma première application Backbone avec une structure similaire à celle Todo MVC example avec Require.js et en utilisant Backbone LocalStorage. Le problème est quand je lance TweetsCollection.fetch()
dans AccueilVoir, Firebug me donne l'erreur: TypeError: options is undefined
var method = options.update ? 'update' : 'reset';
Backbone.js Collection chercher erreur
TweetsCollection:
define([
'underscore',
'backbone',
'backboneLocalStorage',
'models/TweetModel'
], function(_, Backbone, Store, TweetModel) {
'use strict';
var TweetsCollection = Backbone.Collection.extend({
model: TweetModel,
localStorage: new Store('tweets-storage'),
initialize: function() {
console.log('Collection init...');
}
});
return new TweetsCollection();
});
AccueilVoir INIT:
initialize: function() {
this.listenTo(TweetsCollection, 'add', this.addOne);
this.listenTo(TweetsCollection, 'reset', this.addAll);
this.listenTo(TweetsCollection, 'all', this.render);
TweetsCollection.fetch(); // <- Error here
},
J'essaie de suivre l'exemple ci-dessus , mais je suis vraiment perdu avec ça.
Merci! Rétrogradé à 0.9.9 – Potty