Angular 正在从nodejs服务器获取json,但无法在ionic页面上显示-找不到不同的支持对象';[对象对象]';类型为';对象';

Angular 正在从nodejs服务器获取json,但无法在ionic页面上显示-找不到不同的支持对象';[对象对象]';类型为';对象';,angular,ionic3,Angular,Ionic3,得到的回应是:欢迎!回家。ts:44:8 POST响应:对象{passed:true,消息:“sdf”}home.ts:38:10 错误:找不到不同的支持对象“[object]” 类型为“对象”。NgFor仅支持绑定到Iterables,例如 数组 home.module.ts import { Component } from '@angular/core'; import { Http } from '@angular/http'; import { NavController } from

得到的回应是:欢迎!回家。ts:44:8

POST响应:对象{passed:true,消息:“sdf”}home.ts:38:10

错误:找不到不同的支持对象“[object]” 类型为“对象”。NgFor仅支持绑定到Iterables,例如 数组

home.module.ts

import { Component } from '@angular/core';
import { Http } from '@angular/http';
import { NavController } from 'ionic-angular';
import { map } from 'rxjs/operators';
import { Pipe } from 'angular2/core';

@IonicPage()
@Component({
  selector: 'page-home',
  templateUrl: 'home.html',
})
export class HomePage {

  name: string;
  results: any;
 public results: result[];
constructor(private http: Http) {

}

checkName() {

  let data = {
          name: this.name
      };

      this.http.post('http://localhost:8080/checkname', data).pipe(
          map(res => res.json())
      ).subscribe(response => {
        this.results=response;
          console.log('POST Response:', response);
      });

    this.http.get('http://localhost:8080/checkname/' + this.name).pipe(
        map(res => res.json())
    ).subscribe(response => {
        console.log('GET Response:', response);
    });

}
}
home.ts

< ion-item *ngFor="let r of results"/>
{{ r.message }}
< /ion-item>

{{r.message}}


您可以从我的输出中看到,我正在从服务器节点获取json,但无法显示在ionic页面上。

请要求api团队发送此类响应。若数组响应,则必须以数组格式获取,否则给出错误

[{ passed:true, message: "sdf" }]

您是否检查过带有类似错误消息的其他答案?是。但我不知道该怎么办,这里面有什么错。尝试了所有的解决方案。所以最后我问了我自己的QU。我只是想知道我哪里做错了。你所需要做的就是检查
结果是什么。ngFor将只与iTerables合作,请详细说明,因为我是ionichow的noob,我可以如何检查。我在控制台上得到的输出类似于这个对象{passed:true,message:sdf}这是一个令人惊叹的答案。你是对的,我的数组格式不对!很好,我很乐意帮你保管