Parse the template before binding render to an event
This commit is contained in:
parent
d615a5a18b
commit
6ff6ef07a9
1 changed files with 5 additions and 2 deletions
|
@ -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() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue