Parse the template before binding render to an event

This commit is contained in:
lilia 2014-07-22 21:06:55 -10:00
parent d615a5a18b
commit 6ff6ef07a9

View file

@ -9,10 +9,13 @@ var Whisper = Whisper || {};
initialize: function() { initialize: function() {
this.$el.addClass(this.model.get('type')); this.$el.addClass(this.model.get('type'));
this.listenTo(this.model, 'change', this.render); // auto update
this.listenTo(this.model, 'destroy', this.remove); // auto update
this.template = $('#message').html(); this.template = $('#message').html();
Mustache.parse(this.template); Mustache.parse(this.template);
this.listenTo(this.model, 'change', this.render); // auto update
this.listenTo(this.model, 'destroy', this.remove); // auto update
}, },
render: function() { render: function() {