Search code examples
backbone.jsbackbone-eventsbackbone-modelbackbone.js-collections

Bind a method after Backbone's fetch event


var BasicModel = Backbone.Model.extends({

   url : function() {
       return "/something";
    }

});

var basicModel = new BasicModel();
basicModel.fetch();

If BasicModel is a collection, then the follwoing is possible

   this.on("add", function (model) {
         console.log(model);
    });

Is there any lisiting event I can bind for Backbone model, which get invoked after fetch happened?


Solution

  • use change event.

    in your model.

    this.on("change", function);
    

    or in your view

    this.model.on("change", function);