diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2016-04-07 08:27:52 +0200 |
---|---|---|
committer | skjnldsv <fremulon@protonmail.com> | 2016-04-08 10:08:55 +0200 |
commit | f4602b37c163d5d5ec88e6ba437e0be4833ec32c (patch) | |
tree | 610e822a5705e52cc4815a8917815c7e29c5b34a /js | |
parent | e01603c4f58b5062425d7913882294919418594a (diff) |
Fix error loading page when no contacts
Diffstat (limited to 'js')
-rw-r--r-- | js/components/contactList/contactList_controller.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/js/components/contactList/contactList_controller.js b/js/components/contactList/contactList_controller.js index 32eb9d5f..d2b50041 100644 --- a/js/components/contactList/contactList_controller.js +++ b/js/components/contactList/contactList_controller.js @@ -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 |