首页 > 解决方案 > 获取请求不从离子框架返回值

问题描述

尝试调用从 Ionic Framework.API 返回名字和姓氏的 API 对邮递员来说效果很好。但是从离子框架调用,没有得到所需的输出。你能指导一下吗?

离子代码:

import { Component } from '@angular/core';
import { PeopleService } from '../../providers/people-service/people-service';
import { NavController } from 'ionic-angular';

@Component({
  templateUrl: 'build/pages/home/home.html',
  providers: [PeopleService]
})
export class HomePage {
  public people: any;

  constructor(public peopleService:any) {
    this.loadPeople();
  }

  loadPeople() {
    this.peopleService.load()
      .then(data => {
        this.people = data;
      });
  }


  onLink(url: string) {
      window.open(url);
  }
}

HTML 代码:

<ion-navbar *navbar>
  <ion-title>
    Home
  </ion-title>
</ion-navbar>

<ion-content class="home">
  <ion-list>
    <ion-item *ngFor="#person of people">
      <ion-avatar item-left>
        <img src="{{studentData.ProfileImageId}}">
      </ion-avatar>
      <h2>{{studentData.FirstName}} {{studentData.LastName}}</h2>
      <p>{{studentData.ContactEmail}}</p>
    </ion-item>
  </ion-list>
</ion-content>

谢谢。苏达桑

标签: angulartypescriptionic-frameworkionic2

解决方案


推荐阅读