camera in provider

hello i’m new here and ionic framework.
i declared the ‘camera’ but there put this error.
Can anyone know how to solve this problem.

Type ‘CameraOriginal’ is not assignable to type ‘Provider’.
Type ‘CameraOriginal’ is missing the following properties from type ‘FactoryProvider’: provide, useFactory

Hi, @SRoslan
Can you please tell me where you have declared camera that will give error or can you please share your code here so, that I can figure out what exactly the problem is.

here my code. I already added ‘ngx’. but when running the code. It show new error again. and i don’t know how to fix it.
app.module.ts


import { NgModule, ErrorHandler } from '@angular/core';

import { BrowserModule } from '@angular/platform-browser';

import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';

import { Camera } from '@ionic-native/camera/ngx';
import { IonicStorageModule } from'@ionic/storage';
import firebaseConfig from './firebase'
import { AngularFireModule } from '@angular/fire';
import { AngularFireAuthModule } from '@angular/fire/auth'
import { ProvidersAuthProvider } from '../providers/providers-auth/providers-auth';
import { LocationsProvider } from '../providers/locations/locations';
import { ListPage } from '../pages/list/list';
import { Geolocation } from '@ionic-native/geolocation';
import { HawkerProvider } from '../providers/hawker/hawker';
 providers: [
    StatusBar,
    SplashScreen, 
    Camera,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    Geolocation,
    ProvidersAuthProvider,
    LocationsProvider,
    HawkerProvider
  ]

I face this problem with ionic 4 and the solution was add ngx like this:

import { Camera } from '@ionic-native/camera/ngx';

@NgModule({
  declarations: [AppComponent],
  entryComponents: [],
  imports: [
    BrowserModule, 
    IonicModule.forRoot(), 
    AppRoutingModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    })
  ],
  providers: [
    StatusBar,
    SplashScreen, 
    Camera,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ],
  bootstrap: [AppComponent]
})
2 Likes

Gracias Irene me funciono bien

1 Like

Me alegro mucho JuanjoHxq. ¿Podrías marcar mi respuesta como solución? Creo que así otras personas que tengan el mismo problema podrán encontrar rápido la solución :slight_smile:

This is insane :slight_smile: Took me hours . Running ionic v3 and this fixed my issue. Thank you

Thanks you saved my day