2016-07-30 94 views
0

我试图建立SqlStorage在我Ionic2的应用程序,但我并不幸运地做到这一点,因为我收到以下错误:无法设置SQLStorage(_ionicNative.Storage不是构造函数)

我遵循文档,但没有奏效!

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

}); 

回答

2

SqlStorage不包括在ionic-native。所以你必须像这样导入它:

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