Inject service in the provider of the page.module

0

I'm working with Ionic 3 and I'm using some of their native services, such as login with facebook. Everything works perfectly, my problem lies in something I am trying to do to further organize my code.

When I use the facebook plugin for the app.module page everything works perfectly. However, for the sake of organization, I decided to move it to the only page module that actually uses it.

Example:

I have the following pages abertura.ts and abertura.module.ts

When I try to move the facebook plugin import from page app.module.ts to page abertura.module.ts , I get the following error message:

  

ERROR Error: Uncaught (in promise): Error:   StaticInjectorError [Facebook]: StaticInjectorError [Facebook]:       NullInjectorError: No provider for Facebook! Error: StaticInjectorError [Facebook]: StaticInjectorError [Facebook]:       NullInjectorError: No provider for Facebook!

Well, basically he is saying that it was not possible to inject facebook into provider. But why can not I do this on the specified page that uses it?

My code for page abertura.module.ts :

import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { AberturaPage } from './abertura';

import { Facebook } from '@ionic-native/facebook';
import { GooglePlus } from '@ionic-native/google-plus';
import { LinkedIn } from '@ionic-native/linkedin';

@NgModule({
  declarations: [
    AberturaPage,
  ],
  imports: [
    IonicPageModule.forChild(AberturaPage)
  ],
  providers: [
    LinkedIn,
    Facebook,
    GooglePlus
  ]
})
export class AberturaPageModule {}
    
asked by anonymous 26.04.2018 / 19:41

0 answers