[英]Local Storage not being set
I am using Ionic 2. Trying to set a string in local storage. 我正在使用Ionic2。尝试在本地存储中设置字符串。
import { Storage } from '@ionic/storage';
constructor(public storage: Storage) {
}
createChat(chatItem: any): void {
this.storage.ready().then(() => {
var jsonString = JSON.stringify(chatItem);
this.storage.set('chat/' + chatItem.$key + '/', jsonString);
});
}
However, when I look at Chrome's developer tools, the value is not set. 但是,当我查看Chrome的开发人员工具时,未设置该值。
Any help appreciated. 任何帮助表示赞赏。
According to Ionic docs 根据Ionic的文档
When running in the web or as a Progressive Web App, Storage will attempt to use IndexedDB, WebSQL, and localstorage, in that order. 在网络中运行或作为渐进式Web应用程序运行时,Storage会尝试按该顺序使用IndexedDB,WebSQL和localstorage。
So, it is correct that it is not set: you should look into your Chrome IndexedDB
instead of a localStorage
因此,未设置它是正确的:您应该查看Chrome IndexedDB
而不是localStorage
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.