From the course: Learning Backbone.js

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understanding views

Understanding views - Backbone.js Tutorial

From the course: Learning Backbone.js

Start my 1-month free trial

Understanding views

We've come to the part in the course where we need to get our Backbone model and collection data onto a webpage. And in Backbone this gets done with views. We've also arrived at the more difficult part of the course as well, so I want to spend some time outlining how views work overall. Views contain the rules for displaying our model data inside of an HTML structure. What HTML elements should our data be placed inside of? That gets defined in a view. Does Backbone need to create these elements in advance, or are these elements already on our web page? That also gets defined in a view. What methods and properties are needed to actually get the data inside of these web page elements? Again, that gets defined in a view. An important property to define inside a view is template. And this is the first time we're interacting with Underscore in this course. Backbone gets its template functionality directly from Underscore. Now, Backbone does allow for the use of other templating libraries…

Contents