无法设置SQLStorage(_ionicNative.Storage不是构造函数)

时间:2016-07-30 14:39:48

标签: angular typescript ionic2 ionic3

我试图在我的Ionic2应用程序中设置SqlStorage,但我没有幸运,因为我收到以下错误:

我遵循文档,但那不起作用!

  

_ionicNative.Storage不是构造函数

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');

});

1 个答案:

答案 0 :(得分:2)

{p> SqlStorage未包含在ionic-native中。所以你必须像这样导入它:

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