i have to save the contact using ionic2.i have installed cordova-plugin-contacts
here is my code
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Contacts} from 'ionic-native';
@Component({
templateUrl: 'build/pages/contact/user-add/user-add.html',
})
export class UserAddPage {
name:any;
number:any
constructor(private navCtrl: NavController) {
}
addcontact(){
var contact=Contacts.create();
contact.displayName=this.name;
contact.nickname=this.name;
var contactfield=new ContactField();
contactfield.type="mobile";
contactfield.value=this.number;
contactfield.pref=true;
var numbersection=[];
numbersection.push(contactfield);
contact.phoneNumbers=numbersection;
contact.save().then((data)=>{
console.log('saved',data);
},(error)=>{
console.log('error',error);
})
}
}
after that getting this error