Can't display contacts list

hello !
i try to use cordova-plugin-contacts from github in my new app (working with ionic 2 and angular 2)
but i didn’t seccess to display my contact list…I went through the guide but i cant find out why its didnt disaply…
i use ionic lab that transfer my app to my android device.
what am i doing wrong?
i alredy installed cordova plugin add cordova-plugin-contacts
much appreciate Reuven

page.ts

document.addEventListener("deviceready", onDeviceReady, false);

function onSuccess(contacts) {
    alert('Found ' + contacts.length + ' contacts.');
};

function onError(contactError) {
    alert('onError!');
};

function onDeviceReady() {
var options = new ContactFindOptions();
options.filter  = " ";
options.multiple = true;
options.desiredFields = [navigator.contacts.fieldType.id];
options.hasPhoneNumber = true;
var fields  = [navigator.contacts.fieldType.displayName, navigator.contacts.fieldType.name];
navigator.contacts.find(fields, onSuccess, onError, options);
}
1 Like