Problem with use storage

i make login form
after succesfull login i save userID with storage like this'Is_logged', "true");

and i want when the page load first check if Is_logged == true alert me
this is my code'Is_logged').then((Is_logged) => {
this.Is_logged = JSON.parse(Is_logged);

if (this.Is_logged === 'true') {



else {


but it always alert false
where is problem ?
any idea ?

Basic async coding, you alert before you get the value from storage. However you do log after you get it, so I’d imagine it shows up properly in the console right? You should read about async coding and promises, it’s not really an Ionic thing, just a basic javascript thing.

1 Like