Start learning with our library of video tutorials taught by experts. Get started

Up and Running with Backbone.js

Up and Running with Backbone.js

with Joseph LeBlanc

Video: Welcome

(music playing) Hello, I'm Joe LeBlanc. Welcome to Up and Running with Backbone.js. Backbone provides the tools you need to write fully browser-based applications. We're going to take a look at how to do these using techniques like defining your own URLs without going to the server, automatically updating markup when data changes, sorting data in the front-end, and using your server to get the most out of Backbone.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Up and Running with Backbone.js
1h 33m Beginner Apr 12, 2013

Viewers: in countries Watching now:

Backbone helps you separate DOM manipulation from the data powering your web application. In this course, learn how to use Backbone models and collections to manage your data, while displaying it through views. Author Joseph LeBlanc shows you how to use events to change an application's state and avoid messy nested callback functions. He explores modifying resources on the server side via models that reflect the changes in your application, tune your application's performance, and keep the JavaScript environment clear of excessive global variables. He also covers supplementary tools based on Backbone that provide additional functionality.

Topics include:
  • What is Backbone.js?
  • Starting a node server
  • Building routes
  • Creating views
  • Reusing views and building view templates
  • Defining models
  • Loading remote data
  • Organizing collections
  • Adding and removing models
  • Saving and deleting data
  • Bootstrapping data
  • Finding Backbone resources
Subjects:
Developer Web Web Design Web Development
Software:
Backbone.js
Author:
Joseph LeBlanc

Welcome

(music playing) Hello, I'm Joe LeBlanc. Welcome to Up and Running with Backbone.js. Backbone provides the tools you need to write fully browser-based applications. We're going to take a look at how to do these using techniques like defining your own URLs without going to the server, automatically updating markup when data changes, sorting data in the front-end, and using your server to get the most out of Backbone.

Backbone is going to change the way you write web applications. So let's get Up and Running with Backbone.js.

Find answers to the most frequently asked questions about Up and Running with Backbone.js.


Expand all | Collapse all
Please wait...
Q: In the chapter 4 video "Getting models from collections," we modify the code to use the model from the collection in the itemDetails function. But if you go directly to an item page (without first loading the list page), then it doesn't work because the collection isn't loaded. Why is this?
A: When you load a menu item route directly, app.js first runs that initialize() function. Once Backbone.history.start(); is called, it sees the URL pattern and routes to the itemDetails() function, which attempts to get the item from the collection started in initialize(). However, all of this is happening so fast that this.menuItems.fetch(); on line 10 hasn't yet heard back from the server. So the model for menuItemView just comes back as an empty MenuItem object. This blank MenuItem object will not emit any events, and so the view will never update even if the right data eventually gets fed into the collection.
 
There are several different ways you can avoid this. The simplest way (which is what I end up doing in the later chapters) is to have that view always fetch the data directly from the server instead of the collection. If your dataset is even slightly large, this is probably the best way of handling things in general.
 
Otherwise, you could potentially pass the collection to the MenuItemDetails view and listen on its "reset" event, then try fetching the model from it at that point. This isn't as preferable since you're then going to have to find a way of hanging onto that menu item name so you can do the lookup later.
 
Another option might be to block the rendering of the MenuItemDetails view until you know you have the collection data. So you would modify app.js to add a listener for the "reset" event on the collection, and then have that event handler render the view.
Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Backbone.js.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked