Root Page IONIC2 - ionViewWillEnter() EVENT


#1

I want to Auto Login in my App, Through Retrieving the Value from Local, But I can’t able to do it,
It doesnt giving any error nor nothing,I am unable to execute the Query.
Please guide me through the right door.

ionViewWillEnter()   {
      alert("Check Will Enter in Login Page");
      console.log("Login Screen");
    {
      this.database.executeSql("SELECT * FROM user DESC LIMIT 1", []).then((userdata) => {
        {
          let toast = this.toastCtrl.create({
            message: 'User is validated successfully',
            duration: 3000,
            position: 'bottom'
          });

          toast.onDidDismiss(() => {
            console.log('Dismissed toast');
          });

          toast.present();
        }
        this.navCtrl.push(DashboardPage);
         alert("1" + JSON.stringify(userdata));
         alert("Check login_id-" + userdata.rows.item(0).login_id);
         alert("Check password-" + userdata.rows.item(0).password);
        alert("Check password-" + userdata.rows.item(0).mobile_no);
         alert("DeviceID CHECK retrieving from USER" + userdata);

      }, (error) => {
        alert("AUTO LOGIN ERROR" + JSON.stringify(error));

      });
    }
  }

#2

If you don’t get any better answers, I would see if you can use ionic-storage instead of directly trying to deal with SQLite. It’s much easier to deal with.