Skip to content

Commit

Permalink
Show contacts only on #/contacts path
Browse files Browse the repository at this point in the history
  • Loading branch information
dmytroyarmak committed Feb 3, 2014
1 parent c989acc commit 6b33a1d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions app/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand All @@ -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() {
Expand Down

0 comments on commit 6b33a1d

Please sign in to comment.