-
-
Save bm2ilabs/5211987 to your computer and use it in GitHub Desktop.
backbone.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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