In ionic, I am trying to implement Facebook login but in not working, I am getting some error when I click on FB login button.
When I have imported this line
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
it getting this error: type “FacebookOrginal” is not assignable to type ‘Provider’.
Type “FacebookOrginal”
But when I have imported this line
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook/ngx';
it getting this error: Object(…) is not a function at Facebook.login
My code:
import { Component } from '@angular/core'; import { NavController } from 'ionic-angular'; import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook/ngx'; @Component({ selector: 'page-home', templateUrl: 'home.html' }) export class HomePage { constructor(public navCtrl: NavController,public fb: Facebook) { } loginAction(){ // My Login code } }
How can I solved this?
Remove /ngx from this line
import { Facebook, FacebookLoginResponse } from ‘@ionic-native/facebook/ngx’;
Install these:
npm install @ionic-native/core@4.18.0 npm install @ionic-native/facebook@4.18.0
After install these plugins import
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook
Question and answer is powered by AnsPress.io