मुझे समझ में नहीं आ रहा है कि यह क्यों है। मॉडल को view.intialize() में परिभाषित किया जाएगा जब मैं इसे .model.fetch() चलाता हूं लेकिन देखने में नहीं .render()।बैकबोन मॉडल अनिर्धारित है?
define([
'jquery',
'underscore',
'backbone',
'text!templates/example.html'
], function($, _, Backbone, exampleTemplate){
var exampleView = Backbone.View.extend({
el: $('body'),
initialize: function() {
this.model.set({ _id: this.options.user_id });
this.model.fetch({
success: this.render,
error: function(model, response) {
console.log('ERROR FETCHING MODEL');
console.log(model);
console.log(response);
}
});
},
render: function() {
console.log('HELLO FROM RENDER');
console.log(this.model);
console.log('GOODBYE FROM RENDER');
}
});
return exampleView;
});
क्या सफलता प्राप्त होने पर इसे 'संदर्भित किया जा रहा है? शायद आपको इसे बांधना होगा। – JaredMcAteer