Angular2 n - immer invalid argument [object object] ... für Rohr 'AsyncPipe'

Erhalte ich eine Fehler-Anzeige er Ergebnisse meiner service-Aufruf. Die html-Seite hat eine ngFor mit der | async. Ich kann die nennen, die Ergebnisse zu erhalten, aber erhalten Sie eine Fehlermeldung beim Versuch die Seite zu Rendern. Ich weiß, die variable muss zu einer Beobachtbaren, für das asynchrone arbeiten. Ich bin nicht sicher, was ich falsch mache und habe versucht, ein paar Dinge. Jede Einsicht wird sehr geschätzt.

Fehlermeldung:
Invalid argument '[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object],[object object]' Rohr 'AsyncPipe'

Variable Definition

  public products:Observable<Product[]>;

Anruf beim Service

ngOnInit() {

    this.productService.load().subscribe(
      data => {
        //Set the products Array
        this.products = data['_embedded'].products;
      },
      error => console.log('Could not find product catalog.')
    );

}

Service-Aufruf

 load() {
    return this._http.get(`http://localhost:8000/products`).map(response => response.json());
  }

HTML

<tbody *ngFor="let product of products | async">
          <tr>
            <td>{{product.sku}}</td>
            <td>{{product.materialNumber}}</td>
            <td>{{product.price}}</td>
            <td>{{product.baseUom}}</td>
            <td>{{product.packageSize}}</td>
            <td>{{product.casePack}}</td>
            <td>{{product.weight}}</td>
            <td>{{product.height}}</td>
          </tr>
          </tbody>

Daten Aus Call -

Angular2 n - immer invalid argument [object object] ... für Rohr 'AsyncPipe'

InformationsquelleAutor Don | 2016-06-30
Schreibe einen Kommentar