hi guy , i am trying to storage user’s LoginId and token by use storage ,after use login in. but i encounter a strange scene.
i referred this post
Ionic2 arrays in local storage
Store objects in LocalStorage
import { Storage } from '@ionic/storage';
constructor( public storage: Storage, public service: MemberService) { }
console.log(this.storage.get('LoginId'));
this.storage.get('LoginId').then((result) => {
if(result){
console.log(this.storage.get('LoginId'));
} else {
this.storage.set('LoginId', "NotLogin");
// this.rootPage = IntroPage;
}
});
console shows as below:
it can get a setted item loginid but very strange. i do not know why.
is there any other good way to save the data for a period or while?
anyone who can give me guidance? Thanks
t {__zone_symbol__state: null, __zone_symbol__value: Array(0)}
__zone_symbol__state
:
true
__zone_symbol__value
:
"test"
__proto__
:
Object