Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@julianduque
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianduque/10946003 to your computer and use it in GitHub Desktop.
Save julianduque/10946003 to your computer and use it in GitHub Desktop.
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