I have a very simple setup ...
The route is configured, which brings up a modal dialog box using bootstrap. The header of the View calls the method when you click on the menu -
menuClick: function(e){
e.preventDefault();
if (!this.myView) {
this.myView= new MyView({model: new MyModel()});
}
this.myView.render();
},
In MyView, I call bind on initialization
initialize: function(){
this.model.bind('sync', function(model){ alert('test view')});
}
And call Backbone.sync in a button click event:
var response = Backbone.sync('read', this.model, {
success: function(data, textStatus, jqXHR) { alert('success'); },
error: function(data, textStatus, jqXHR){ alert(fail); }
});
A warning inside synchronization is raised ... but a warning in the bind command in initialization is never raised. I tried to move the binding inside the model, pulled it out, also tried synchronization: fail, sync: done. No success.
source
share