__zone_symbol__state: null, __zone_symbol__value: Array(0)


#1

While i try to read any data as a value, i got __zone_symbol__state: null, __zone_symbol__value: Array(0) but when i check the storage there is an array.

this.storage.get("key").then((res)=>{console.log(res)})

Why could be reason

Thanks in advance


#2

Wherever you get the “strange” __zone_symbol__state: null, __zone_symbol__value: Array(0), you are reading the promise, not the resolved value. If you experience this in a view…assign you res to a member of of your controller and bind the view to that value or use the | async pipe inside your view.


#3

The async pipe is for observables in this case, so that shouldn’t work.

But the rest of what is being said here is true.
storage.get returns a promise, not the value.
You’ll need to unwrap the promise in a .then

strorage.get('key')
.then( res => console.log(res));

#4

Sure? https://angular.io/docs/ts/latest/api/common/index/AsyncPipe-pipe.html states “The async pipe subscribes to an Observable or Promise and returns the latest value it has emitted”


#5

shows how little I use the async pipe :smile:


#6

This is not first time i am using stroge .The last app which is done i used this syntax below and it works fine

storage.get("key").then((res)=>{console.log(res)})

and it was 2.2 ionic .


Retrieve a value once from Firebase