@andika1204 wrote:
I have a problem, when I login to the application. Native storage on Ionic keeps the login result data well but when I close my application, the data on
nativestorage
is gone and also I’m not triggerthis.nativeStorage.remove()
command. Anyone know what cause this? And how to solve it? i’m using ionic 3This is the login data when I logged in
{ "phonenumber":"12341234", "username" : "bingo" }
but when I close the application
{ "phonenumber":"", "username":"" }
the declaration variable
login : any ={ phonenumber : '', username : '', }
the set function
SetLogin(_login : any) { this.login.phonenumber = _login.phonenumber; this.login.username = _login.username; this.nativeStorage.setItem('Loginmodel',this.login ); }
the get function
GetLogin() { this.nativeStorage.getItem('Loginmodel') .then( data => { console.log(data); this.login = data; }, error => console.error(error) ); return this.login; }
Posts: 3
Participants: 2