Created
September 27, 2011 14:48
-
-
Save ZeeAgency/1245237 to your computer and use it in GitHub Desktop.
Question Backbone pour Neiluj
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
var mouetteView = Backbone.View.extend({ | |
el: '#mouette-container', | |
initialize: function() { | |
this.mouettes = new mouetteList(); // (collection de mouettes) | |
this.mouettes.bind('all', this.render, this); | |
this.mouettes.fetch(); | |
this.template = _.template($('#mouette-template').html()); | |
}, | |
render: function() { | |
// Ça a toujours fonctionné jusqu'à présent, mais on est d'accord que le .fetch() pourrait ne pas être terminé et donc this.mouettes pourrait être vide ? | |
// Quand est appelé .render() ? | |
var renderedContent = this.template({ mouettes: this.mouettes.models }); | |
$(this.el).html(renderedContent); | |
// Pourquoi on retourne this ici ? | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment