Skip to content

Commit

Permalink
Fix error loading page when no contacts
Browse files Browse the repository at this point in the history
  • Loading branch information
skjnldsv committed Apr 7, 2016
1 parent 6e2f1ff commit 75da85f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions js/components/contactList/contactList_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,13 @@ angular.module('contactsApp')

// Get contacts
ContactService.getAll().then(function(contacts) {
$scope.$apply(function() {
ctrl.contacts = contacts;
});
if(contacts.length>0) {
$scope.$apply(function() {
ctrl.contacts = contacts;
});
} else {
ctrl.loading = false;
}
});

// Wait for ctrl.contactList to be updated, load the first contact and kill the watch
Expand Down

0 comments on commit 75da85f

Please sign in to comment.