Add Contact

Hi,

I’m encountering an issue when I try to add a new contact in my app. For now, I’m just trying to reproduce the simple example in the documentation.

Then, when I want to try with ionic emulate android, compilation fail and I retrieve this error Left-hand side of assignment expression cannot be a constant or a read-only property.

When I look into the Contact’ class, I notice that every properties are declared with the readonly keyword. Did I miss something? Is anybody encountering the same issue ? What should I do?

Thanks in advance for your answer

1 Like

same here… I also tried to do it with navigator.contacts (works in ionic view) and it says during the build process that “property ‘contacts’ does not exist on type ‘Navigator’” and i have already installed all the required (cordova) plugins…

ok I found the answer that helped me. so you can add a contact that way -> https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-contacts/
but you have to reference in your typescript code phonegap.d.ts (from here https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/phonegap/phonegap.d.ts) like that
///<reference path"../../../plugins/phonegap.d.ts"/>

This saved my life, hope it helps you…