Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. var contacts = [<contact-number-1>, <contact-number-2>, <contact-number-3>];
  2. var promises = _.times(2, function (index) {
  3. console.log('Finding contact: ' + contacts[index]);
  4. return $cordovaContacts
  5. .find({
  6. multiple: true,
  7. desiredFields: ['name', 'phoneNumbers'],
  8. filter: contacts[index],
  9. fields: ['phoneNumbers']
  10. })
  11. .then(function (c) {
  12. console.log('contact');
  13. console.log(c);
  14. return c;
  15. })
  16. .catch(function(error) {
  17. console.log(error);
  18. });
  19. });
  20.  
  21. console.log('promises.length: ' + promises.length);
  22.  
  23. $q.all(promises).then(function(results) {
  24. console.log('results');
  25. console.log(results);
  26. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement