如何使用Ionic Storage通过ionic 3从api存储json对象? [英] How to use Ionic Storage to store json object from api with ionic 3?

查看:181
本文介绍了如何使用Ionic Storage通过ionic 3从api存储json对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何使用Ionic Storage来将Json Object与Ionic 3一起存储.我发现这很困难,因为没有适用于Ionic 3的示例,并且被卡住了.网上似乎什么都没有更新.离子存储的支持示例将很有用.预先谢谢你.

I would like to know how to use Ionic Storage to store Json Object with Ionic 3. I am finding it difficult as there are no examples for the ionic 3 and i am stuck. Nothing on the net seems to be updated. A supporting example for Ionic Storage would be of great use. Thank you in advance.

推荐答案

是的,您可以将JSON对象存储在 离子存储 .

Yes, you can store JSON objects in Ionic storage.

  let your_json_object = { "name":"John", "age":30, "car":null };

  // set a key/value
  storage.set('my-json', your_json_object);

  // to get a key/value pair
  storage.get('my-json').then((val) => {
    console.log('Your json is', val);
  });

这篇关于如何使用Ionic Storage通过ionic 3从api存储json对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆