All examples

The app, models and views

This example is mainly about getting a feeling for MVC classes with Backbone.js


In the developer console you can require the different modules:

app, app.movies, app.Movies, app.MovieView, app.MoviesList

The development console is really useful to examine parts of an application. For example, to change state in a model.

If you change state of a model, the view is notified and re-renders.

Sandbox setup:

First, you can try to select a movie from the console, i.e. change the "selected" property of the model.

Selection can be done on a model with:

movie.set('selected', 1);

Selection can be done on a collection with:

movies.selectByID(1);

De-selecting can be done on the collection with:

movies.resetSelected();

The Movie DOM