Problem importing Facebook

Hello everyone, thanks to read my problem, i have a problem in App.Module.ts, I can’t import in my App.module.ts “Facebook” and I don’t know what.

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { HttpModule } from '@angular/http';
import { Facebook, FacebookLoginResponse } from '@ionic-native/facebook';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    HttpModule
  ],
  providers: [
    StatusBar,
    SplashScreen,
    Facebook, (HERE THE ERROR)
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

When i do this, console says :

“Invalid provider for the NgModule ‘AppModule’ - only instances of Provider and Type are allowed, got: [StatusBar, SplashScreen, ?[object Object]?, …]”

If I delete “Facebook” from app.module.ts console says:

BlockquoteError: StaticInjectorError(AppModule)[HomePage -> Facebook]

¿How can i solve the problem? ¡¡Thanks again!!

Ionic:

ionic (Ionic CLI) : 4.9.0
Ionic Framework : @ionic/angular 4.0.0
@angular-devkit/build-angular : 0.12.3
@angular-devkit/schematics : 7.2.3
@angular/cli : 7.2.3
@ionic/angular-toolkit : 1.2.3

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.3.2, (and 4 other plugins)

System:

NodeJS : v8.10.0 (/usr/bin/node)
npm : 3.5.2
OS : Linux 4.15

1 Like

try to
import { Facebook } from '@ionic-native/facebook/ngx';
in app.module.ts

2 Likes