Skip to content

Instantly share code, notes, and snippets.

@mdb
Created December 17, 2012 13:25
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 mdb/4318264 to your computer and use it in GitHub Desktop.
Save mdb/4318264 to your computer and use it in GitHub Desktop.
var DirectoryView = Backbone.View.extend({
el: $("#recordings"),
initialize: function () {
this.collection = new Directory(contacts);
this.render();
},
render: function () {
var that = this;
_.each(this.collection.models, function (item) {
that.renderContact(item);
}, this);
},
renderContact: function (item) {
var contactView = new ContactView({
model: item
});
console.log("this logs out the proper markup: ", contactView.render().el);
// but this does not seem to append anything to this.$el (div#recordings):
this.$el.append(contactView.render().el);
/* this.$el looks like this:
{
context: #document,
selector: "#recordings"
}
*/
}
});
var directory = new DirectoryView();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment