Trying to use IonicStorageModule, not resolving methods

I just updated to latest Ionic 2.2.0 and local Storage stopped working - so I’m attempting to move everything to using IonicStorageModule. I have followed the instructions at but the methods get, set, remove, etc. are all reporting that they don’t exist.

In my modules I do stuff like:

import { IonicStorageModule } from '@ionic/storage';

constructor(public navCtrl: NavController, 
              public local_storage: IonicStorageModule) {}

someCode () {
   this.local_storage.set('login_user', email).then(() => {...

The errors I see are similar to:

[12:22:16]  typescript: src/pages/login/login.ts, line: 251 
            Property 'set' does not exist on type 'IonicStorageModule'. 

Any recommendations? Thanks in advance.

Cordova CLI: 6.4.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.4
ios-deploy version: 1.9.0
ios-sim version: 5.0.11
OS: macOS Sierra
Node Version: v6.9.3

IonicStorageModule is only for importing into your app module. When using it, one just injects the Storage provider, not the module.

1 Like

Thanks. I was there originally. Went back to that - and now I’m seeing:

Can't resolve all parameters for Storage: (?).

The stack looks like:

Error: Can't resolve all parameters for Storage: (?).
    at v (http://localhost:8100/build/polyfills.js:3:4864)
    at SyntaxError.BaseError [as constructor] (http://localhost:8100/build/main.js:163067:27)
    at new SyntaxError (http://localhost:8100/build/main.js:26304:16)
    at CompileMetadataResolver._getDependenciesMetadata (http://localhost:8100/build/main.js:46069:31)
    at CompileMetadataResolver._getTypeMetadata (http://localhost:8100/build/main.js:45944:26)
    at CompileMetadataResolver._getInjectableMetadata (http://localhost:8100/build/main.js:45932:21)
    at CompileMetadataResolver.getProviderMetadata (http://localhost:8100/build/main.js:46174:40)
    at http://localhost:8100/build/main.js:46132:49
    at Array.forEach (native)
    at CompileMetadataResolver._getProvidersMetadata (http://localhost:8100/build/main.js:46099:19)
    at CompileMetadataResolver.getNonNormalizedDirectiveMetadata (http://localhost:8100/build/main.js:45572:30)
    at CompileMetadataResolver._loadDirectiveMetadata (http://localhost:8100/build/main.js:45460:23)
    at http://localhost:8100/build/main.js:45661:54
    at Array.forEach (native)
    at CompileMetadataResolver.loadNgModuleDirectiveAndPipeMetadata (http://localhost:8100/build/main.js:45660:41)

Please double-check that you actually did follow all the instructions in the link you mentioned in your first post. Specifically, make sure that you took Storage out of your AppModule’s providers.

1 Like

Yes, followed those instructions.

My imports:

 imports: [
    AngularFireModule.initializeApp (firebaseConfig, authConfig),

My providers:

  providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}, 
              {provide: Globals, useClass: Globals}, 
              {provide: ActivityTracker, useClass: ActivityTracker}]

Where I’m using Storage (such as in my login.ts module) I import it as:

import { Storage } from '@ionic/storage';

1 Like

Is it possible you’re declaring Storage in a providers array of some other module or component? I just tried this with a scratch project and everything worked fine. If I add Storage to the providers array of the app module, I see the same error you are encountering.

Thank you. I did discover a buried provider referencing Storage - and removed it. Now to fix an ion-split-panel issue… which I just discovered is now called ion-split-pane… :wink: