From 6b33a1dfac88fc702f408bd89fc9c1dfe0192be8 Mon Sep 17 00:00:00 2001 From: Dmytro Yarmak Date: Mon, 3 Feb 2014 11:14:20 +0200 Subject: [PATCH] Show contacts only on #/contacts path --- app/js/app.js | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/app/js/app.js b/app/js/app.js index 14bedd2..24d841d 100644 --- a/app/js/app.js +++ b/app/js/app.js @@ -4,15 +4,8 @@ window.ContactManager = { Views: {}, start: function(data) { - var contacts = new ContactManager.Collections.Contacts(data.contacts); - - var contactsView = new ContactManager.Views.Contacts({ - collection: contacts - }); - - $('.main-container').html(contactsView.render().$el); - - var router = new ContactManager.Router(); + var contacts = new ContactManager.Collections.Contacts(data.contacts), + router = new ContactManager.Router(); router.on('route:home', function() { router.navigate('contacts', { @@ -22,7 +15,11 @@ window.ContactManager = { }); router.on('route:showContacts', function() { - console.log('Show contacts'); + var contactsView = new ContactManager.Views.Contacts({ + collection: contacts + }); + + $('.main-container').html(contactsView.render().$el); }); router.on('route:newContact', function() {