1
I made an application to bring the contacts from the device. My doubt is the following when I bring the phone it brings me an array, with type:mobile, value="" with the phone, how can I do a treatment to bring only the number?
<ion-list>
<ion-item ng-repeat="contact in contacts">
{{contact.displayName}}, {{contact.phoneNumbers}
</ion-item>
</ion-list>
.controller("contatosCtrl", function ($scope, $cordovaContacts) {
$scope.getContactList = function () {
$cordovaContacts.find({
filter: ''
}).then(function (result) {
$scope.contacts = result;
}, function (error) {
console.log("ERROR: " + error);
});
}
});
Since it is an array, you will have to use ng-repeat to pick up each phone, or use {{contact.phonenumbers[0]. value}} to pick up the first one. But this may give error if there is no element in the array.
– Rafael
All right, I’ll try it here, @Rafael.
– rodrigo.oliveira
@Rafael ,I was able to solve, using the way you indicated and so I also found another error of mine, I had put a key to more "{{contact.phonenumbers[0]. value}}". Thank you very much!
– rodrigo.oliveira