Join Kai Gittens for an in-depth discussion in this video Adding properties to the model view, part of Up and Running with Backbone.js.
Okay, let's get started by building the view for a single model instance.…So, I'm in singleFlowerView.js.…This is where the single view code will be going, and…I'm going to go over to snippets.txt.…And I'm going to highlight and copy lines 10 through 19 and…go back to singleFlowerView and paste this code in and save it.…So, as I've done for models and…collections, I'm name spacing my code on line two.…On line five, I'm creating a name space variable called app.singleFlowerView and…using it to create a brand new view with Backbone.View.extend.…
Let's gradually add some more code.…So, back to snippets.txt.…And highlight and copy lines 27 through 28 and go back to singleFlowerView.js.…And I'm going to paste this code inside of my view object.…Get rid of this extra white space and save it.…So, I'm starting to configure this view with properties that…are available to all views.…tagName defines which HTML tag my single model data should be placed in.…
I've said in the last movie, this is going to be an article tag, so…
- What is Backbone.js?
- Understanding how MVC libraries work
- Adding properties to a model
- Creating a collection of models
- Adding properties to a model view
- Loading model data on a web page
- Configuring routes
- Finding Backbone resources