I am using the contacts plugin and then showing a list of contacts from a user search form. On some devices it shows the same user twice if they have multiple phone #'s in the system. On other devices it only shows one. I would like it to only show one on all devices. (If this is not possible I at least want access to the second phone #. Right now the duplicates show the exact same phone #). Here is a snippet of my code to only show users with Al in the name.
`
$scope.getAllContacts = function(searchQuery) {
try{
var opts = { //search options
filter : searchQuery, // 'Bob'
multiple: true, // Yes, return any contact that matches criteria
fields: [ 'displayName', 'name' ]
};
if(ionic.Platform.isAndroid()){
opts.hasPhoneNumber = true; //hasPhoneNumber only works for android.
};
$scope.isLoadingShow=0;
$ionicLoading.show();
$cordovaContacts.find(opts).then(function (contactsFound) {
$scope.contacts = contactsFound;
$scope.isLoadingShow=1;
$ionicLoading.hide();
});
}catch(err){
alert(err.message);
}
};
$scope.getAllContacts("Al"); `