hello
i have a problem for getting value from storage or behavior subject before running my app, in my authentication.service.ts i have this :
export class AuthenticationService {
authenticationState= new BehaviorSubject(false);
GuestState= new BehaviorSubject(false);
public WhatsnewState= new BehaviorSubject(false);
constructor(private storage:Storage,private plt:Platform) {
this.plt.ready().then(()=>{
this.checkToken();//this work fine
});
}
checkWhatsNewState(){
return this.storage.get('whatsNew').then(val =>{
if(val != null){
this.WhatsnewState.next(true);
}
});
}
isSkipwn(){
return this.WhatsnewState.value;
}
and now is my app.component.ts in constructor i can’t get data at starting up my app:
let welcomeShow:any;
this.authService.WhatsnewState.subscribe((val)=>{
console.log('log wlcs',val)
;welcomeShow= val;
});
console.log(' welcome ',welcomeShow);
but i have always welcomeShow false and also in subscribe i have two console.log , once “log wlcs false” and seconde is true, also i try to define welcomeShow before constructor and in subscribe write this.welcomeShow but it not working
thanks for your solution.