Skip to content

Instantly share code, notes, and snippets.

@bm2ilabs
Forked from JeffreyWay/backbone.js
Created March 21, 2013 10:10
Show Gist options
  • Save bm2ilabs/5211987 to your computer and use it in GitHub Desktop.
Save bm2ilabs/5211987 to your computer and use it in GitHub Desktop.
backbone.js
// In Backbone, when passing a collection around, do you prefer to inject the
// collection into the view, or store it on a global namespace?
// Injection
var SomeCollectionView = Backbone.View.extend({
initialize: function() {
// this.collection
}
});
new SomeCollectionView({ collection: App.myCollection });
// Or store and reference collection on namespace.
var SomeCollectionView = Backbone.View.extend({
initialize: function() {
// App.myCollection
}
});
new SomeCollectionView;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment