Marionette ItemView how to re-render model on change

后端 未结 2 1900
灰色年华
灰色年华 2021-02-05 06:25

I\'m using Handlebars template engine.
so, I have Model:

Backbone.Model.extend({
        urlRoot: Config.urls.getClient,
        defaults: {
            con         


        
2条回答
  •  再見小時候
    2021-02-05 07:05

    In the View, You can use following code

        modelEvents: {
            'change': 'render'
        }
    

    instead of

       initialize: function () {
            this.model.on('change', this.render, this);
        },
        onRender: function () {
            console.log(this.model.toJSON());
         }
    

提交回复
热议问题