Remember user login

I’m making an app in ionic but stuck at a place, so basically what I need is once a user logs in inside the app and closes it the user should remain logged in and next time when he opens the app it should directly take him to the app without login page but if he opts to logout then he have to provide the id and password again.
Can anyone help me out

below is my code

import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams, LoadingController } from 'ionic-angular';
import { HomePage } from '../home/home';
import { MyaccPage } from '../myacc/myacc';
import { MyprofPage } from '../myprof/myprof';
import { CommonTasks } from '../../app/common_tasks';
import { Http,Headers } from '@angular/http';
import * as $ from 'jquery';
import 'rxjs/Rx';

 * Generated class for the UsrloginPage page.
 * See for more info on
 * Ionic pages and navigation.

  selector: 'page-usrlogin',
  templateUrl: 'usrlogin.html',
export class UsrloginPage {
  public username: any;
  public password: any;
  public loginProcessUrl: string = "http://myapilogin.php";

  constructor(public navCtrl: NavController, public navParams: NavParams, public commonTasksObj: CommonTasks, public http: Http) {


  ionViewDidLoad() {
    console.log('ionViewDidLoad UsrloginPage');
  close() {
 // }
 // myacc() {
  //  console.log(this.username + " " + this.password);
  //  this.navCtrl.setRoot(MyaccPage);
  myprof() {

  validateForm() {
    if (this.username == undefined || this.username.trim() == "") {
      this.commonTasksObj.displaySimpleToast("Please Enter your Username");
      return false;
    if (this.password == undefined || this.password.trim() == "") {
      this.commonTasksObj.displaySimpleToast("Please Enter your Password");
      return false;



  loginProcess() {
     var form = new FormData();
     form.append("id", this.username);
     form.append("pass", this.password);, form)
       .subscribe(data => {
         var dataObj = JSON.parse(data['_body']);
      // },error =>{});
        this.commonTasksObj.displaySimpleToast("Login Successful");
      var userObj = dataObj.user_data;
        this.commonTasksObj.displaySimpleToast("Please Check Your Credentials");

  <div class="cardlogin">
    <ion-card style="border-radius:15px; margin-top:40px">
        <ion-item class="close-btn"(click)="close();">
        <ion-icon name="close-circle" item-right></ion-icon>
        User Login
        <ion-list no-lines>
              <ion-input input type="text" placeholder="Username" [(ngModel)]="username" name="username"></ion-input>
              <ion-input input type="password" placeholder="Password" [(ngModel)]="password" name="password"></ion-input>
        <button ion-button block color= "#3b5998"(click)="validateForm();">Login</button>
        <a>Forgot Your Login Details</a>

below is the response from api

Hi@uddyvky You can use ionic native storage for this purpose.If a user is logined,then the user will have a userid.Set the userid in the native storage. Next time login call native storage getvalue.if userid exist navigate to the page you want to navigate.
ionic native storage

This will give you the idea for what you are trying to do
above constructor:

in constructor:
if (localStorage.getItem(“EmployeeID”) === null)
console.log(“not logged in”);
this.rootPage = LoginPage;
console.log(“already logged in”);
this.rootPage = TabsPage;