I don't understand why I have this error again and again... when I had a new provider. When I had any other provider like geolocation etc I have this error :
Error: Uncaught Error: Invalid provider for the NgModule 'AppModule' - only instances of Provider and Type are allowed, got: [StatusBar, SplashScreen,?[object Object]?, ...]
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { ImagePicker } from '@ionic-native/image-picker';
import { Crop } from '@ionic-native/crop';
import { AuthService } from '../pages/core/auth.service';
import { UserService } from '../pages/core/user.service';
import { FollowService } from "../pages/core/follow.service";
import { AngularFireModule } from 'angularfire2';
import { AngularFireAuthModule } from 'angularfire2/auth';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { environment } from '../environment/environment';
import { MyApp } from './app.component';
import { LoginPage } from '../pages/login/login';
import { RegisterPage } from '../pages/register/register';
import { WelcomePage } from '../pages/welcome/welcome';
import { HomePage } from '../pages/home/home';
@NgModule({
declarations: [
MyApp,
LoginPage,
RegisterPage,
WelcomePage,
HomePage,
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(environment.firebase),
AngularFireAuthModule,
AngularFireDatabaseModule,
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
LoginPage,
RegisterPage,
WelcomePage,
HomePage,
],
providers: [
StatusBar,
SplashScreen,
ImagePicker,
Crop,
AuthService,
UserService,
FollowService,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Try to add /ngx
to the path, as follows, in Ionic 4:
import { File } from '@ionic-native/file/ngx';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With