Join Kai Gittens for an in-depth discussion in this video Challenge: Create a new model and watch when it changes, part of Up and Running with Backbone.js.
- View Offline
…[SOUND] Now, it's time to test what we've learned so far with a challenge,…where you create some new model instances, a new collection, and watch for changes.…You should create two new instances, based on the app.singleFlower model.…You should create one called Tantalizing Tulips and…another one called Fleur-de-lis.…Each should have a price and color, and…these values can be anything that you want them to be.…
And both should be assigned to…a collection you create called EuropeanFlower.…Next, I want you to change the Tantalizing Tulips' properties by…giving it a new key value pair,…where its key is called originCountry and its value is called Holland.…Now, you want two console messages to appear in your web browser console.…One that appears any time an instance changes and…another one detailing the structure of the European flower collection.…
This challenge should take you about fifteen minutes and…the files for the challenge are in the 0202-04 folder, and…there are probably a few ways to do this, just to give you a heads up.…
- 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