Skip to content

Instantly share code, notes, and snippets.

@julianduque

julianduque/main.js

Last active Aug 29, 2015
Embed
What would you like to do?
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
You can’t perform that action at this time.