【发布时间】:2018-09-13 14:37:25
【问题描述】:
存储。获取函数在函数之外返回空值。 这是我的代码
username:any;
this.storage.get('user').then((value) => {
this.username = value;
});
console.log(this.username);
output : undefined;
【问题讨论】:
-
请注意
this.storage代码? -
什么意思请解释一下?
-
我的意思是你的
this.storage定义在哪里?你是说本地存储吗? -
你是否设置了用户的数据......
-
this.storage.set('user',detail);是的,我已经在用户中设置了数据
标签: angular typescript ionic3