Summary

In this chapter, we learned how to keep models and views in sync. In general, syncing model and views is easy but things can turn difficult if the model has embedded arrays. You can use a plugin to simplify the data binding; Backbone.Stickit is a good option because it allows you to make your bindings in a declarative way.

I showed you how you can make two-way data binding with a vanilla Backbone, taking advantage of the event system; it's not always a good idea to use intensive two-way data binding in your applications but in some cases it can be useful.

Finally, we learned how to validate models with Backbone and how to use the validation API to show error messages in views. The Backbone.Validation plugin can help you to validate Backbone ...

Get Mastering Backbone.js now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.