Created
December 17, 2012 13:25
-
-
Save mdb/4318264 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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