Error get list contact

hello , I am trying contact list and be able to select in order to send an invitation: but not work on both the browser and on the device. Error: EXCEPTION: Uncaught (in promise): TypeError: Cannot read property ‘find’ of undefined
ts:

constructor(public navCtrl: NavController) {
Contacts.find([“displayName”, “phoneNumbers”], {multiple: true, hasPhoneNumber: true}).then((contacts) => {
console.log(contacts);
for (var i = 0; i < contacts.length; i++) {
if (contacts[i].displayName !== null) {
var obj = {};
obj[“name”] = contacts[i].displayName;
obj[“number”] = contacts[i].phoneNumbers[0].value;
this.contacts.push(obj); // adding in separate array with keys: name, number
}
}
this.groupContacts(this.contacts);
})

}

groupContacts(contacts){

let sortedContacts = contacts.sort(function (a, b) {
  if (a.name < b.name) return -1;
  if (a.name > b.name) return 1;
  return 0;
});

let currentLetter = false;
let currentContacts = [];

sortedContacts.forEach((value, index) => {
  if (value.name.charAt(0) != currentLetter) {
    currentLetter = value.name.charAt(0);

    let newGroup = {
      letter: currentLetter,
      contacts: []
    };

    currentContacts = newGroup.contacts;
    this.groupedContacts.push(newGroup);
  }
  currentContacts.push(value);
});

}
}

Ionic-native has moved from static class methods to injectables. You need to inject an object of type Contacts in your constructor and call find on that. Your IDE should have flagged this.

Thanks it work great :slight_smile: