0
을 템플릿에 값을 추가, 나는 또한 템플릿이 있습니다백본 underscorejs 내가 Backbonejs의 간단한 추가 이벤트가
initialize: function()
{
this.template = _.template($("#person-template").html());
}
renderperson: function(model)
{
//model.name is "Jack" for example
//Now I want to render this template with Name replaced with "Jack"?
$("#somelement").append(); //What to do here???
}
템플릿은 간단하다 :
<script type="text/template" id="person-template">
<div class="person"><%= Name %></div>
</script>
'this.template'당신이 초기화 함수에 _.bindAll (이)를 추가 않은 기능 – user50992
가 아니다? –
오 렌더링 사용자의 기능을 초기화하기 위해 추가하지 않았습니다. 이제 작동합니다. 죄송합니다. 감사합니다. :) – user50992