You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/08/29 23:13:22 UTC

[GitHub] candradeg9182 opened a new issue #166: Contacts plugin issue: Cannot set property 'name' of undefined

candradeg9182 opened a new issue #166: Contacts plugin issue: Cannot set property 'name' of undefined
URL: https://github.com/apache/cordova-plugin-contacts/issues/166
 
 
   Hi,
   
   When I try to assign this :
   new ContactName(null, 'Smith', 'John');
   
   into contact.name  :
              let contact: Contact = this.contacts.create();
   
                 let usuario = new ContactName(null, 'Smith', 'John');
                 console.log(typeof usuario)
   
                 contact.name = new ContactName(null, 'Smith', 'John'); <-- failure occurs here
                 contact.phoneNumbers = [new ContactField("mobile","6471234567")];
                 contact.save().then(
                 () => console.log("Contact saved!", contact),
                 (error: any) => console.error("Error saving contact.", error)
                 );
               }
   
   
   I get an error:
   ERROR TypeError: Cannot set property 'name' of undefined
       at Contact.set [as name] (decorators.js:195)
       at HomePage.add (home.ts:85)
       at Object.eval [as handleEvent] (HomePage.html:191)
       at handleEvent (core.js:13589)
       at callWithDebugContext (core.js:15098)
       at Object.debugHandleEvent [as handleEvent] (core.js:14685)
       at dispatchEvent (core.js:10004)
       at core.js:10629
       at HTMLButtonElement.<anonymous> (platform-browser.js:2628)
       at t.invokeTask (polyfills.js:3)
   
   I im indeed importing :
   import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';
    Into the page that I want to use it, and I'm importing the contacts into the constructor.
   
   Also I'm adding into providers the 
   import { Contacts} from '@ionic-native/contacts';
   
   and I have installed :
   $ ionic cordova plugin add cordova-plugin-contacts
   $ npm install --save @ionic-native/contacts
   
   
   
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org