Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Contacts plugin - Can't create after update. #1250

Closed
jgw96 opened this issue Mar 24, 2017 · 2 comments
Closed

Contacts plugin - Can't create after update. #1250

jgw96 opened this issue Mar 24, 2017 · 2 comments

Comments

@jgw96
Copy link

jgw96 commented Mar 24, 2017

From @Klerith on March 23, 2017 23:35

Ionic version:
[ ] 1.x
[ X ] 2.x

I'm submitting a ...
[ X ] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:
After the new change of moving 'ionic-native' to '@ionic-native/contacts', this plugin doesn't work or maybe I am missing something here ( I was using the previous version with no problems )

When I try to execute this line on runtime
let contact: Contact = this.contacts.create();

I get this error, that basically, saids I can't call create of undefined.
image

Expected behavior:
Create a contact object with no issues.

Steps to reproduce:
Just follow the ionic Contacts tutorial

http://ionicframework.com/docs/v2/native/contacts/

Related code:

This is my app.module

@NgModule({
  declarations: [
    MyApp,
    HomePage,
    GuardadosPage,
    MapaPage,
    TabsPage
  ],
  imports: [
    IonicModule.forRoot(MyApp),
    AgmCoreModule.forRoot({
      apiKey: 'XXXXXXXXXX'
    })
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    GuardadosPage,
    MapaPage,
    TabsPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    BarcodeScanner,
    InAppBrowser,
    Contacts,
    HistorialService,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

Also in my service, I am injecting the "Contacts" module.

I am kind of lost here.

Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.1
ios-sim version: 5.0.13

OS: macOS Sierra
Node Version: v6.9.5
Xcode version: Xcode 8.2.1 Build version 8C1002

Copied from original issue: ionic-team/ionic-framework#10900

@jgw96
Copy link
Author

jgw96 commented Mar 24, 2017

From @rapropos on March 24, 2017 0:0

Should probably be reassigned to ionic-native, but I suspect the problem is failure to adjust to the new injectable syntax:

OLD:

import {Plugin} from "ionic-native";

constructor() {
  Plugin.frobulate();
}

NEW:

import {Plugin} from "@ionic-native/plugin";

constructor(plugin: Plugin) {
  plugin.frobulate();
}

@jgw96
Copy link
Author

jgw96 commented Mar 24, 2017

From @Klerith on March 24, 2017 0:4

I use the new syntax version using '@ionic-native/contacts'

But after running some test here, looks like it works on devices, but in the browsers crashes with that error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant