Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
addContact(): void {
let contact: Contact = this.contacts.create();
contact.name = new ContactName(null, 'Smith', 'John');
let number = new ContactField('mobile', '6471234567');
contact.phoneNumbers = [number];
contact.save().then(
() => console.log('Contact saved!', contact),
(error: any) => console.error('Error saving contact.', error)
);
}
createContact() {
const contact: Contact = this.contacts.create();
contact.name = new ContactName(null, 'Smith', 'John');
contact.phoneNumbers = [new ContactField('mobile', '6476476477', true)];
contact.save()
.then(v => this.result = v)
.catch(v => this.error = v);
}