Last active
August 29, 2015 14:07
-
-
Save ykhs/f64df63c8e223c3d00aa to your computer and use it in GitHub Desktop.
JavaScript養成読本 特集1 第4章 リスト3 訂正
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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