0
我剛開始使用backbone.js和ICanHaz.js進行模板化。但模板沒有得到渲染。ICanHaz模板不渲染
var MovieView = Backbone.View.extend({
render : function() {
this.model.movies.each(function(mov) {
console.log("In view " + mov.get('title') + " " + mov.get('format') + " " + mov.get('rating'));
});
var da = JSON.parse(JSON.stringify(this.model.toJSON()));
console.log("Moviedata " + da);
var movList = ich.movies_tmpl(da);
$('#movieList').append(movList);
return this;
}
});
控制檯日誌打印電影數據。但不在瀏覽器中。 \ n
而且在我的HTML,
<script id="movies_tmpl" type="text/html">
<li id="movie_{{ cid }}">
<p>Title : {{ title }}</p>
<p>Format : {{ format }}</p>
<p>Rating : {{ rating }}</p>
</li>
</script>
<h1>MovieApp</h1>
<a href="#movies/add">Add New Movie</a>
<ul id="movieList"></ul>
TIA, 阿倫
請解釋 – johannes