Chapter 3. Working with Models
JavaScript models are an essential part of client-side data management. In stateful JavaScript applications, local or remote data is stored in models and the model provides a number of functions to work with this data such as conversions, validations, data persistence, and so on. Backbone models are no different than these and provide similar functionalities such as set/get data, validate, save to or fetch from the server, delete an attribute, and sync with the server.
In this chapter, we will discuss some basic problems with models that Backbone developers usually face, and will then propose some possible solutions to them. Also, we will cover a few interesting plugins and extensions for models that will help reduce boilerplate in your code. The main points to be covered are as follows:
Basic usage of models: Learn the basics of Backbone models, such as important methods, properties, and data operations.
Validating the data: We will see how basic data validations...