JavaScript養成読本 特集1 第4章 リスト3 訂正
var ContactView = Backbone.View.extend({ | |
render: function() { | |
// HTMLテンプレートを取得する | |
var template = $('#contact-template').html(); | |
// HTMLテンプレートにモデルのデータを適用する | |
// モデルのtoJSON()メソッドを使って属性を | |
// オブジェクトの形式で書き出す | |
var compiled = _.template(template) | |
var html = compiled(this.model.toJSON()); | |
// 自身が保持しているDOM要素を更新する | |
this.$el.html(html); | |
return this; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment