How to add a phone number to the existing contact using ionic 3


#1

i am using ionic-native contacts plugin
using pick contact i am getting specific contact details, how to modify this contact and save it .

this.contacts.pickContact().then((Contact)=>{
          console.log("contacts:-->"+ JSON.stringify(Contact));
          });

#2

i found the solution for this

this.contacts.pickContact().then((Contact)=>{
  console.log("contacts:-->"+ JSON.stringify(Contact));
  this.clonecontact(selectedcont);

  });


clonecontact(selectedcont){
  console.log("clone contact called");
  console.log("clone:-->"+ JSON.stringify(selectedcont));

  
  selectedcont.phoneNumbers = [new ContactField('mobile', '99......3')];
  selectedcont.save().then(
    () => console.log('Contact saved!'),
    (error: any) => console.error('Error saving contact.', error)
  );

}