NullInjectorError: No provider for Storage!


#1

Hi, I am using @ionic/storage but I am getting the error NullInjectorError: No provider for Storage!. However, the Storage is imported in app.module:

imports: [
    BrowserModule,
    HttpClientModule,
    TranslateModule.forRoot({
      loader: {
        provide: TranslateLoader,
        useFactory: (createTranslateLoader),
        deps: [HttpClient]
      }
    }),
    IonicModule.forRoot(MyApp),
    IonicStorageModule.forRoot(),
    PerfilUsuarioBajaPageModule,
    PerfilUsuarioDatosPageModule
  ]

What can be causing this?

Thanks.


#2

Hi,

If you component is contained in one of your submodules (for example in PerfilUsuarioDatosPageModule), you need to add the ionic storage module to the imports of your submodule.