Everything You Need to Know



Data is the source of all truth in an app. You can use plain JavaScript objects. But models provide a powerful way to manage data. Models offer feature not available in plain JavaScript objects.

ChocolateChip-UI models can hold a single object of key value pairs, or an array of objects with key value pairs. When rendering their templates, the views do not care whether the data is an object or an array of objects. The view examines the data of the model. If its a single object, the view renders it. If the data is an array of objects, the view loops over the objects, rendering each one with its template.

Models encapsulate your data so that it is only accessible through the model's interface. This protects your data from unintentional modification. You can also register events on a model which you can then trigger when necessary.