Ionic 4 beta Contact create not working

hello ,

i have worked on ionic 4 beta and angular cli 6.1.4
when i have install contact plugin and put the doc code in my application then show error.

core.js:1633 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'then' of undefined
TypeError: Cannot read property 'then' of undefined

here is my code

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule, RouteReuseStrategy, Routes } from '@angular/router';
import { HttpModule } from '@angular/http';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { Contacts } from '@ionic-native/contacts/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

  declarations: [AppComponent],
  entryComponents: [],
  imports: [
  providers: [
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  bootstrap: [AppComponent]
export class AppModule { }

My page code

import { Contacts, Contact, ContactField, ContactName } from '@ionic-native/contacts';

  selector: 'app-addvisitor',
  templateUrl: './',
  styleUrls: ['./'],
  providers: [Contacts]

constructor(private contacts: Contacts) {  

addContact() {

    let contact: Contact = this.contacts.create(); = new ContactName(null, 'Smith', 'John');
    contact.phoneNumbers = [new ContactField('mobile', '6471234567')];
      () => console.log('Contact saved!', contact),
      (error: any) => console.error('Error saving contact.', error)


that’s the error, the /ngx is missing, like you did in your app.module.ts

Hi @reedrichards,

i have changed and add ngx but now contact save but show blank. means name and number not showing on contact card.

1 Like

No idea. I just know why you where facing your original error

Same problem here :frowning:
I can’t set the name of a new contact…

same issues with contacts plugin :frowning: