Skip to content

Instantly share code, notes, and snippets.

@brettjonesdev
Last active April 27, 2017 23:26
Show Gist options
  • Save brettjonesdev/0def1c73b49d7092a4295d636a942f24 to your computer and use it in GitHub Desktop.
Save brettjonesdev/0def1c73b49d7092a4295d636a942f24 to your computer and use it in GitHub Desktop.
const App = new Application();
App.selectedTodos = new Backbone.Collection();
// List Route
const collection = new TodoCollection();
collection.fetch().then(() => {
const listView = new ListView({collection}).render();
});
// ListView
const ListView = Backbone.View.extend({
select(model) {
App.selectedTodos.add(model);
},
unselect(model) {
App.selectedTodos.remove(model);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment