Data binding with plugins

As you can see in the previous section, Backbone does not provide an easy mechanism to sync your models and the views that use them. Some plugins for Backbone have been developed to minimize this issue; one of them is Backbone.Stickit.

If you want an easy and yet powerful way to bind DOM nodes and Backbone models, Backbone.Stickit will do a great job:

var FormView = ModelView.extend({
template: '#form-template',
  bindings: {
    '#name': 'name',
    '#phone': 'phone',
    '#email': 'email'
  },
  onRender: function() {
    this.stickit();
  }
});

The preceding code example shows how it looks; please consult the project documentation to learn more about it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.157.142