【问题标题】:data is not shown on ionic view page after retrieving data检索数据后,数据未显示在离子视图页面上
【发布时间】:2019-09-07 05:02:07
【问题描述】:

我正面临在离子视图中显示数据的问题。 我已经尝试了一些代码。它还没有工作。当我在 ts 文件上打印出 $person 时,我得到了 [object Object]。我的 json obj 就像 {"user_name":"user123", "full_name": "yiemon", "email":"yiemon@gmail.com"}。请帮帮我。

这是我的 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;
  }  

这是我的 menu.html

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

【问题讨论】:

    标签: cordova ionic-framework node-modules


    【解决方案1】:

    解析JSON对象并以{{userProfile.user_name}}这种方式调用数据后,数据出现。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-14
      • 1970-01-01
      • 2021-12-09
      • 2016-04-13
      • 2019-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多