Cordova Contacts plugin with Searchbar


i have used the cordova Contacts plugin to get the contact list in the application.
i have put the search bar on top to search within the list.

Method to initialize the pluging

let options = {
  multiple: true,
  hasPhoneNumber: true,
  contactFields: ['displayName']
Contacts.find(['*'], options).then((contact) => {
  this.contactarray = contact;      
  console.log(this.contactarray); // This shows the complete object.      
  console.log(this.contactarray.displayName); // it says undefined :( IDK why....
}, (err) => {})




Here i got the displayName property of the contact object and is displays the contact names perfectly, but i am not able to get displayName property in TS file.

i need the displayName property in the TS file to let the searchbar works properly…



The below code working for me. Searches for all contacts those have ‘ra’ in their displayName

let options = {
multiple: true,
hasPhoneNumber: true,
filter: ‘Ra’
let cantactFields = [‘displayName’];
Contacts.find(cantactFields, options).then(res => {
for(var i=0; i<res.length; i++){
}, (er) => {