From 6ff6ef07a91a8856883e97aa82465988eefd6e63 Mon Sep 17 00:00:00 2001 From: lilia Date: Tue, 22 Jul 2014 21:06:55 -1000 Subject: [PATCH] Parse the template before binding render to an event --- js/views/message_view.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/js/views/message_view.js b/js/views/message_view.js index 2d44bc13..d8699531 100644 --- a/js/views/message_view.js +++ b/js/views/message_view.js @@ -9,10 +9,13 @@ var Whisper = Whisper || {}; initialize: function() { 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(); Mustache.parse(this.template); + + this.listenTo(this.model, 'change', this.render); // auto update + this.listenTo(this.model, 'destroy', this.remove); // auto update + }, render: function() {