Iterating through an array in the handlebar

If you have an array of objects, using the following way we can iterate through each object

 "lineItems": [
    {{#each record.salesOrderLookup as |item|}}
      {
        "partNumber": "{{item.partNumber}}",
        "quantity":{{item.quantity}},
        "unitPrice": {{item.unitPrice}},
        "estimatedShipDate": "{{item.estimatedShipDate}}"
      }{{#if @last}}{{else}},{{/if}}
       {{/each}}
]

Leave a comment

Your email address will not be published. Required fields are marked *