Last active
August 29, 2015 13:59
-
-
Save julianduque/10946003 to your computer and use it in GitHub Desktop.
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
myMusic = {}; | |
myMusic.Song = Backbone.Model.extend({}); | |
myMusic.SongView = Backbone.View.extend({ | |
tagName: "li", | |
className: "item", | |
template: Handlebars.compile($("#song-template").html()), | |
initialize: function () { | |
this.render(); | |
}, | |
render: function(){ | |
//var song = this.model; | |
//var cancion = song.get("cancion"); | |
//var autor = song.get("autor"); | |
var html = this.template(this.model.toJSON()); | |
this.$el.html(html); | |
return this; | |
} | |
}); | |
var song = new myMusic.Song({ cancion: "Always", autor: "Blink 182" }); | |
var songView = new myMusic.SongView({ model: song }); | |
$("#listaCanciones").append(songView.el); | |
window.myMusic = myMusic; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment