From 1156a5555bddce8d5986fffa4c9b6227f6bd0694 Mon Sep 17 00:00:00 2001 From: Dmytro Yarmak Date: Mon, 3 Feb 2014 10:57:03 +0200 Subject: [PATCH] Render all contacts in contacts view --- app/js/views/contacts.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/js/views/contacts.js b/app/js/views/contacts.js index c5492ea..4ab6b1a 100644 --- a/app/js/views/contacts.js +++ b/app/js/views/contacts.js @@ -1,9 +1,17 @@ ContactManager.Views.Contacts = Backbone.View.extend({ template: _.template($('#tpl-contacts').html()), + renderOne: function(contact) { + var itemView = new ContactManager.Views.Contact({model: contact}); + this.$('.contacts-container').append(itemView.render().$el); + }, + render: function() { var html = this.template(); this.$el.html(html); + + this.collection.each(this.renderOne, this); + return this; } });