2016-07-30 18 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';