Ionic 2 Cannot read property appInvite undefined

I have created fab list for inviting people through social media apps. When anyone clicks on say “FaceBook” button, one should have access to friend list and be able to send app invite or link to selected. I am using App link/ App invitation for that. While clicking on “facebook” button, I am receiving below error:

error_handler.js:60 TypeError: Cannot read property ‘appInvite’ of undefined
at PrimaryCaregiversPage.fbInvite (primary-caregivers.ts:61)
at CompiledTemplate.proxyViewClass.View_PrimaryCaregiversPage0.handleEvent_44 (/AppModule/PrimaryCaregiversPage/component.ngfactory.js:1070)
at CompiledTemplate.proxyViewClass. (view.js:664)
at HTMLButtonElement. (dom_renderer.js:489)
at t.invokeTask (polyfills.js:3)
at Object.onInvokeTask (ng_zone.js:264)
at t.invokeTask (polyfills.js:3)
at e.runTask (polyfills.js:3)
at HTMLButtonElement.invoke (polyfills.js:3)

Note: I am testing this through http server.

Can you post the code of this method?

Here, fbInvite() is a click method for button.


        url: "https://myfbappurl",
        picture: ""
        if(postId) {
            if(postId.completionGesture == "cancel") {
            } else {
        } else {
            // user just pressed done, bad guy
        // error


I think you forgot to import the module in your app.module.ts!

import { Facebook } from ‘@ionic-native/facebook’;

I have already imported the module in app.module.ts.

I am not sure if my code mentioned is correct for applink/ app inivte. Let me know if this is the only method in typescript.

It have to look like this in your *.module.ts

import { Facebook } from '@ionic-native/facebook';

constructor(private fb: Facebook) {

 this.fb.appInvite(options, options.url, options.picture) 


I can’t see any differences in the documentation:

Not working. received below error.

typescript: src/pages/invite-people/invite-people.ts, line: 61
Supplied parameters do not match any signature of call target.

  L61:  **this.fb.appInvite(**

Quick question: is there anyway to test applink without hosting the app?