I’m new to Meteor and Angular. What I’m basically trying to achieve is to retrieve contacts from a device and show them based on their birth date.
Right now my code can retrieve contacts and display them in the log but I just can’t figure out a way to store the retrieved list to a cursor or an array and display them at the front-end.
The following is my code -
if(Meteor.isCordova){
var options = new ContactFindOptions();
options.filter = "";
options.multiple = true;
var fields = ["displayName", "name"];
var birthlist = navigator.contacts.find(fields, onSuccess, onError, options);
console.log(birthlist);
function onSuccess(contacts) {
console.log(contacts.length + ' contacts');
for (var i = 0; i < contacts.length; i++) {
console.log("Display Name = " + contacts[i].displayName);
}
}
function onError(contactError) {
console.log('onError!');
}
}
Thank you.