How to get only number and name from contact list


#1

how to get only number and name from contact list.basically i want to implement a contact list .like whats app.how can i do that?please help me anyone
thanks in advance.


#2

Go through it, It will help you…!

var opts = {
filter : “”,
multiple: true,
hasPhoneNumber:true,
fields: [ ‘displayName’, ‘name’ ]
};
this.contacts.find([ ‘displayName’, ‘name’ ],opts).then((contacts) => {
this.contactlist=contacts;
let ii=0;
let contIDArray:any=[];
let nameArray:any=[];
let contArray:any=[];
for (let i of this.contactlist) {
if(i.displayName==null){
i.displayName=“unknown”;
}
contIDArray.push(ii);
nameArray.push(i.displayName);
contArray.push(i.phoneNumbers[0][‘value’]);
this.contactList[ii]={id:contIDArray[ii],contactName:nameArray[ii],contact:contArray[ii]};
ii++;
}