Ionic native contacts are not working?

i am using this …

contacts.find([‘displayName’,‘phoneNumbers’], { filter: “”, multiple: true })
.then(data => {
this.contactlist = data
});

i am get name but not contact number …

this is my project i am try tu show my contacts on my app …any friend use this

you have the number there also, should be an array .
Do a :

console.log(data);

The problem is how you render it on UI, i believe you do not take the phonenumber correctly from data object.

Do the console.log of data and you’ll see the object structure… form there you’ll get it how to take the phonenumber, i believe there is an aray phoneNumbers and you have to take the personalizedNumber… Share UI part please if you need more help

hy @iscorobogaci

how to get the data in this array …

{
“_objectinstance”: {
“id”:“452”,
“rawld”:“452”,
“displayName”:“Poglo”,
“name”: {
“givenName”:“Poglo”,“formated”:“Poglo”
},
“nickname”:null,
“phoneNumbers”:[{
“id”:“1493”,“perf”:false,“value”:“1010”,“type”:“mobile”
}],
“emails”:null,
“addresses”:null,
“ims”:null,
“organizations”:null,
“birthday”:null,
“photos”:null,
“categories”:null,
“urls”:null
}
}

this is my files…

.ts

constructor(…){
this.contacts.find([‘displayName’, ‘phoneNumbers’], { filter: “”, multiple: true })
.then(data => {
this.contactlist = data;
});
}

html

{{contact.displayName}}

{{ contact.phoneNumbers}}

name show but i need phone number …? please check

Hey man, you need in your html template to change {{ contact.phoneNumbers}} with :

contact.phoneNumbers[0].value

Did you mentioned that for phoneNumbers you receive an array, and this is logical right, because an contact can have multiple phone numbers. Take a look a javascript arrays and how to get data , iterate through etc…So the only mistake you made is not reffering to the correct attribute and not knowing the data you’re working with. Spend some time on understanding javascript objects, arrays etc … This will help you in the future. In any questions or help needed, you can always reach me at scorobogaciion@gmail.com