Marionette ItemView how to re-render model on change

后端 未结 2 1898
灰色年华
灰色年华 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());
         }
    
    0 讨论(0)
  • 2021-02-05 07:10

    Actually, Backbone and Marionette are smart enough to do it.
    Problem was in template and data as I found it another question. So, I re-checked everything and got result.

    0 讨论(0)
提交回复
热议问题