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 - Backbone.js Tutorial
From the course: Learning Backbone.js
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
(Locked)
Understanding views4m 13s
-
(Locked)
Adding properties to the model view2m
-
(Locked)
Creating and configuring templates7m 1s
-
(Locked)
Creating a collection view5m 43s
-
(Locked)
Loading model data on a webpage4m 38s
-
(Locked)
Challenge: Create a template2m 45s
-
(Locked)
Solution: Create a template2m 42s
-
(Locked)
-
-