1

I'm confused on how would i get the value of material.sku in these arrays of objects? This is what i have tried below.enter image description here

html

<td>
    <select formControlName="material_id" class="col-md-12">
        <option *ngFor="let mat_order of mat_orders.materials" [ngValue]="mat_order.material_id">
            {{ mat_order.sku}} 
        </option>
    </select>
 </td>

ts

.subscribe(
  (data:any) => {
    this.mat_orders = data.supplies;
    console.log(mat_orders);

  },
  error => {
   alert("Error");
   console.log(error);
 })
1
  • mat_orders.materials specify index of mat_orders . for example mat_orders[0].materials Commented Nov 2, 2017 at 11:07

1 Answer 1

1

you should access the 0th index,

  <select formControlName="material_id" class="col-md-12">
        <option *ngFor="let mat_order of mat_orders[0].materials" [ngValue]="mat_order.material_id">
            {{ mat_order.sku}} 
        </option>
    </select>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.