Skip to content

Commit

Permalink
Set contactsFactory internal contacts after syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
melonmanchan committed Feb 16, 2016
1 parent ced751e commit 33333c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/js/controllers/contacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var contacts = angular.module('contacts', ['ngCordova', 'peerhandler'])

contactsFactory.fetchContactsFromServer().then(function (contactsList) {
$scope.$apply(function () {
contactsFactory.setContacts(contactsList);
$scope.contacts = contactsList;
$scope.preloaderClass = 'preloader-off';
});
Expand Down
3 changes: 2 additions & 1 deletion app/js/services/contactshandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ angular.module('contacts').factory('contactsFactory', function($cordovaContacts,
})
.then(function (syncedContacts) {
$localStorage.contactsBeenSynced = true;
self.contacts = syncedContacts
self.setContacts(syncedContacts);
resolve(syncedContacts);
})
.catch(function (err) {
Expand Down Expand Up @@ -93,6 +93,7 @@ angular.module('contacts').factory('contactsFactory', function($cordovaContacts,
},

setContactStateIfApplicable: function (number, state) {
console.log(contacts);
var index = _.indexOf(contacts, this.getContactByNumber(number));

if (index === -1) {
Expand Down

0 comments on commit 33333c3

Please sign in to comment.