Got this error Cannot find a differ supporting object '[object Object]' of type 'object'. NgFor only supports binding to Iterables such as Arrays

131 views Asked by At

Got this error somebody help, want to display data on frontend, data is stored in dynamodb local database, I use get API call. angular

node server response

display.component.html file

  <tbody>
      <h1> Testing</h1>

      <tr *ngFor="let thread of threads " >
          <td>{{ thread.threadId }}</td>
          <td>{{ thread.threadType }}</td>
          <td>{{ thread.createDate }}</td>
          <td>{{ thread.updateDate }}</td>
          <td>{{ thread.channelName }}</td>
      </tr>

  </tbody>

display.component.ts file

  threads : thread[];

  constructor(private bs: DataService) { }

  ngOnInit() {
    this.bs.getthreads().subscribe((data: thread[]) => {
        this.threads = data;
    });
  }
}

data.service.ts

export class DataService {

  uri = 'http://localhost:4000/data';

  constructor(private http: HttpClient) { }

  getthreads() {
    return this
           .http
           .get(`${this.uri}`);
  }
}
1

There are 1 answers

0
Victor Rodniansky On

Please try this.

 getthreads() {
    return this
           .http
           .get(`${this.uri}`)
           .map(result=>result["Items"]);
 }