姬長信(Redy)

如何在ion-list angular 2 ionic 2中显示已解析的…


我得到了一个数组;在控制台中,它们每个都包含标题,链接,描述,图像和pubDate,但数据未显示在ion-list中.
你可以帮帮我吗?

下面是rss-service.ts中的load()函数

load() {
  return Observable.create(s => {
    this.http.get('http://url.xml')
      .map(res => res.text())
      .subscribe(data => {
        if(data) {
          var parser = new DOMParser();
          var xmlData = parser.parseFromString(data, "application/xml");
          var items = xmlData.querySelectorAll("item");
          for (var index = 0; index 

home.ts

export class HomePage {

  public entries: any  = [];

  constructor(public rssService:RssService, public nav:NavController) {    
  }

  ionViewDidLoad(){
      this.rssService.load().subscribe(
          data => {
              this.entries.push(data);
          }
      );
  } 

  openPage(entry) {
      console.log('open page called with ' + entry.title);
      this.nav.push(DetailPage, {selectedEntry:entry});
  }
}

home.html


  
    
     App Name
    
  



  
    
        
      

{{entry.title}}