获取请求不从离子框架返回值

时间:2018-06-20 01:28:33

标签: angular typescript ionic-framework ionic2

尝试调用从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>

谢谢。 苏达珊

0 个答案:

没有答案