Maxim
Maxim

Reputation: 137

data is not shown on ionic view page after retrieving data

I am facing the problem of displaying data on View in ionic. I have tried some code. It didn't work yet. When I print out $person on ts file, I got [object Object]. My json obj is like {"user_name":"user123", "full_name": "yiemon", "email":"[email protected]"}.Please help me.

This is my menu.ts

async ionViewWillEnter() {
     this.person$ = from(this.authService.getProfile().then((res) => {
      this.authService.setProfile(res.data);
      console.log(res.data);
      return res.data;
    })); 

    console.log("User_"+this.person$);
    //this.username=this.authService.userProfile.username;
  }  

This is my menu.html

  <ion-col class="menu_bottom" >
          <!--  {{(person$ | async)?.user_name}} -->
           <!-- {{person$.user_name}} --> 
            {{person$?.user_name}}         
   </ion-col>

Upvotes: 0

Views: 23

Answers (1)

Maxim
Maxim

Reputation: 137

After parsing the JSON object and calling the data this way {{userProfile.user_name}}, the data appears.

Upvotes: 1

Related Questions