I'm attempting to implement the Todo-example given in the Spine.js docs, given here: http://spinejs.com/docs/example_tasks
only I'd like to use Handlebars instead of jQuery.tmpl. I'm using Handlebars 1.0.rc.1
However, when I attempt to call:
template: Handlebars.compile($('#history-template').html()),
render: function(){
var t = this.template(this.item);
this.replace(t);
return this;
}
Handlebars throws an exception at this.template(this.item)
:
Uncaught TypeError: Cannot call method 'match' of undefined
In the Handlebars lexer, this._input
is coming back as undefined.
My template is as follows:
<script id='history-template' type='text/x-handlebars-template'>
<div class="content-inner {{#if viewed}}msg_unseen{{/if}}">
<div>{{data}}</div>
</div>
</script>
Data:
"[{"data":"hello","id":"c-0"}]"
Any ideas?