0
我正在嘗試檢索localStorage值;但是,我不能得到任何價值,我的日誌如下所示:JavaScript/Ionic2 - 爲什麼我無法檢索localStorage值?
日誌:{}
這是到目前爲止我的代碼:
import {Storage, LocalStorage} from 'ionic-angular';
//I am storing here
this.local = new Storage(LocalStorage);
this.local.set('options', 'op2');
//In the chrome developer tools, I can see that the value was stored successfully in localStorage
//I can't see anything, when trying to retrieve the stored value
console.log('log is : '+ JSON.stringify(this.local.get('options')));
什麼的localStorage和存儲在這裏? – Cyril
LocalStorage是從'ionic-angular'使用以下'import Storage,LocalStorage}導入的;' –
那麼如何使用setItem(...)而不是set(..)以及getItem(..)。 – Darek