Displaying Content from a Model
Understand how to use Marionette and Backbone to display dynamic model data in your web applications. Learn to define models, create views linked to templates, and render content securely using templating tags. This lesson guides you through instantiating models and views to manage and display data effectively.
We'll cover the following...
Now that we’ve covered displaying static content, let’s move on to displaying content containing data from a model. As you may know, one of Backbone’s selling points is the possibility of structuring JavaScript applications with a model-view-controller (MVC) pattern. In this pattern, we use so-called models to interact with our data, passing them onto views for rendering the information they contain.
So, let’s declare a model within our JavaScript block above our view declaration:
We simply declared a model named Contact and attached it to our ContactManager app here. As we can see, this model ...