Hamza L.
Hamza L.

Reputation: 1823

Unable to setup SQLStorage (_ionicNative.Storage is not a constructor)

I'm trying to setup SqlStorage in my Ionic2 app, but I was not lucky enough to do so as I am receiving the following error:

I following the documentation, but that didn't work!

_ionicNative.Storage is not a constructor

import {SqlStorage, Storage, StatusBar} from 'ionic-native';

SaveInfo(){

this.storage = new Storage(SqlStorage, { name: 'userInfo' });

return this.http.get(this.postUrl, {search:params})
               .subscribe(
                 data => {

     this.storage.set('userName', 'Jhonny23');
     this.storage.set('userType', 'Normal');

});

Upvotes: 0

Views: 123

Answers (1)

sebaferreras
sebaferreras

Reputation: 44669

SqlStorage is not included in ionic-native. So you'll have to import it like this:

import {Storage, SqlStorage} from 'ionic-angular';

Upvotes: 2

Related Questions