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.

Loading model data on a webpage

Loading model data on a webpage - Backbone.js Tutorial

From the course: Learning Backbone.js

Start my 1-month free trial

Loading model data on a webpage

Okay, we've modeled our data. We've attached the data to a collection. We've made sure that the models and collections each have their own views. We've constructed page elements and we've created templates where we can place our data. We now need to add some data to this whole process in order to get some content to display on our web page. That's what we'll be doing in this movie inside of flowerApp.js. Now, in the last movie, we created a collection view called app.allFlowersView. It had a custom addFlower method that triggered most of the activity I outlined a few moments ago. It was a really, really powerful part of the collection view. All it needs to get going is some model data. And if we could find some data to plug into this view, we can get our data to display on a web page. We can do that with a few lines of code. Which I'll grab from snippets.txt. So go over there. And I'm going to highlight and copy lines 117 to 119, and go back to flowerApp.js and I'm going to place them…

Contents