이 jQuery 템플릿을 underscorejs 템플릿으로 변환하려고했지만 왜 작동하지 않는지 이해가되지 않습니다. 왜 그 이유를 설명 할 수 있습니까?이전에서 변환시 언더 코어 템플릿 오류가 발생했습니다.
el: $('#contents'),
template: _.template(MenuTemplate),
//template: $('#item-tmpl').template(),
render: function()
{
this.$el.empty();
//$.tmpl(this.template, this.model.toArray()).appendTo(this.el);
// Old jquery template
//this.$el.html(this.template(this.model.toArray()).appendTo(this.el));
//underscore template
return this;
}
어떤 문제가 있습니까? 나는 템플릿을 사용하고 루트 요소에 설정하는 기술을 이해하지 못한다. ('appendTo'에 대한 호출은 불필요하다.) 예제는 [here] (http://backbonejs.org/#View-render)를 참조하십시오. – WiredPrairie