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 models easily with minimal effort, once validation callbacks are set correctly.

In the next chapter, we will learn how to modularize our contacts application to make it more maintainable and more effectively manage dependencies. Then we will bundle the whole application in a single script to load it faster.

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

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