Ionic 2 storage string, get a strange string


#1

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

#2

i try it again. it suddenly work fine.


#3

I changed your post to format your code or error message correctly. Please use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.