Making cordova-plugin-contacts work in Ionic2


#1

For some reason my application fails to read contacts from user’s phone:

get(){
Contacts.find([’*’]).then((lists) => {
this.contacts = lists;

    let contentHeader: Headers = new Headers({"Content-Type": "application/json"});
    let url = `http://localhost:8080/api/contacts`;
    return this._http.post(url, lists, {'headers': contentHeader});                       
});

}

The template

<button type="button" (click)="get()">Contacts</button>
<ion-list>
    <ion-item *ngFor="let contact of contacts">{{contact.displayName}}</ion-item>
</ion-list>

I can’t understand why it fails to read contacts. Any help ?


#2

I tried to add new contact but there are more error
Did you reach to a solution?