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
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
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.
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));
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”
shows how little I use the async pipe 
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 .
I Solved this
yes
it is really easy for start in you`re service create a function and then paste below text on that. for example i have a method to show PROFILE info in USER-STORAGE service
//read user to show in profile pages
//Iuser this my interface you can see on below
// this method return Promise
read_to_show_profile(): Promise {
return this.storage.get(user_storage_DB);
}
/ /
export interface Iuser {
id: string;
name: string;
mobileNumber: number;
city: string;
subCity: string;
galleryName: string;
imageSrc: string;
}
/ */
and then in you`re component u can import SERVICE and use it like below
MY.COMPONENT.TS file
public current_usr: Iuser = {};
constructor(
private storage_service: StorageUserService
) {}
ngOnInit() {
//read data from local storage and assign it to CURRENT_USER
this.storage_service.read_to_show_profile().then(result => {
this.current_usr = result;
console.log(this.current_usr);
});