Property removeContact does not exist on type 'Contacts'



I’m using ionic 2

here’s my code:

import { Contacts, ContactFindOptions } from ‘@ionic-native/contacts’;
import { CallNumber } from ‘@ionic-native/call-number’;

selector: ‘page-home’,
templateUrl: ‘home.html’,
providers: [Contacts]

export class HomePage {
items: any[];
itemsAll: any[];

constructor(public navCtrl: NavController,private contacts: Contacts,private event: Events, private callNumber: CallNumber) {

initializeItems() { this.items = [];
const options = new ContactFindOptions();
options.filter = ""
options.multiple = true;
options.hasPhoneNumber = true;

this.contacts.find([’*’], options)
.then(data => {
this.items = data;
this.itemsAll = data;

this.contacts.removeContact(); // error here

How can I handle this error?



I did not find a removeContact() method for the Contacts object in the API on first glance. May be you are looking for the remove() method of the Contact object?

If the item object is a valid Contact object here, then try this:



Additionally, you only very rarely want to be declaring providers on components, and I can’t think of a reason why this would be such a situation.