Reload Side-Menu when recalled


#1

Hi i am loading my data from native storage and calling it in app.component.ts to be shown on “app.html”

Ok so when a user updates his username, In order to view i restart the application and it displays data correctly.
but i don’t know how to reload data without restarting the application so i could be shown on side menu.

App.HTML

app.component.ts:


#2

Please post code as text, not images.


#3

App.component.ts:

initializeApp() {
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
this.statusBar.styleDefault();
this.splashScreen.hide();
});

this.nativeStorage.getItem('s_name')
.then(
  data => {
    console.log("Checking s_name:" + data);
    this.s_name = data;
  },
  error => console.error(error)
);
this.nativeStorage.getItem('name')
.then(
  data => {
    console.log("Checking s_name:" + data);
    this.name = data;
  },
  error => console.error(error)
);


this.nativeStorage.getItem('auth')
.then(
  data => {
    console.log("Checking Auth value:" + data);
    this.auth = data;
  },
  error => console.error(error)
);

this.nativeStorage.getItem('onetimelogin')
.then(
  data => {
    console.log("Checking onetimelogin:" + data);
    this.onetimelogin = data;

  },
  error => console.error(error)
);


this.nativeStorage.getItem('onetimeloginprov')
.then(
  data => {
    console.log("Checking onetimeloginprov:" + data);
    this.onetimeloginprov = data;

  },
  error => console.error(error)
);

}

App.html

<ion-menu [content]=“content” id=“menu1”>

<div align="left" style="margin-top:6%;">
    <ion-item no-lines style="background-color:transparent">
    <ion-avatar align="center">
      <img src="imgs/userp.png" style="width: 32%;height: 77px;margin-left: 1px;"/>
      </ion-avatar>
      </ion-item>
    </div>

    <div align="right" style="padding-right: 85px;margin-top: -81px;">
    <h4 style="color:black;margin-left: -8px;">User Name</h4>   <!--{{s_name}}-->
  </div>
    

<ion-list no-lines style="background-color:transparent;margin-top: 46px;padding-left: 21px;">

    <ion-item style="background-color:transparent" (click)="OnLoad(home)">
        <ion-icon name="ios-home-outline" item-start style="color:#5f27c0"></ion-icon>
          <b style="color:#5f27c0">Home</b>
      </ion-item>


  <ion-item style="background-color:transparent" (click)="OnLoad(fav)">
    <ion-icon name="ios-heart-outline" item-start style="color:#5f27c0"></ion-icon>
      <b style="color:#5f27c0">My Favourites</b>
  </ion-item>

  <ion-item style="background-color:transparent" (click)="OnLoad(history)">
    <ion-icon name="ios-clock-outline" item-start style="color:#5f27c0"></ion-icon>
    <b style="color:#5f27c0">Order History</b>
  </ion-item>

  <ion-item style="background-color:transparent" (click)="OnLoad(lecture)">
    <ion-icon name="ios-person" item-start style="color:#5f27c0"></ion-icon>
    <b style="color:#5f27c0">Edit Profile</b>
  </ion-item>

  <ion-item style="background-color:transparent" (click)="OnLoad(lecture)">
    <ion-icon ios="ios-cog" md="md-cog" item-start style="color:#5f27c0"></ion-icon>
    <b style="color:#5f27c0">Change Password</b>
  </ion-item>

  <ion-item style="background-color:transparent; margin-top:118px" (click)="reloadprov()">
    <ion-icon name="ios-contacts" item-start style="color:black"></ion-icon>
    <b style="color:black">Switch to Provider</b>
  </ion-item>

  <ion-item style="background-color:transparent" (click)="logout()">
    <ion-icon name="ios-log-out-outline" item-start style="color:black"></ion-icon>
    <b style="color:black"> Logout</b>
  </ion-item>
</ion-list>

#4

I’m not seeing the part of the application where this happens.


#5

Thanks but I have figured it out.