I have just started using Handlebars.Net. I have a template containing:
{{#each InvoiceLines}}
Desc = {{Description}} , Cost = {Cost}}
{{/each}}
My data object is as per below:
public class Data
{
public bool IsRenewalInvoice { get; set; }
public List<InvoiceLine> InvoiceLines { get; set; }
}
public class InvoiceLine
{
public string Description { get; set; }
public string Cost { get; set; }
}
However, I am getting a HandlebarsUndefinedBindingException: 'Description is undefined'. I have also tried using this and InvoiceLine before the property name of the list item as below but that also does not work.
Desc = {{this.Description}} , Cost = {this.Cost}}
Desc = {{InvoiceLine.Description}} , Cost = {InvoiceLine.Cost}}
How do I get this to work?
Also, if the list is nested in another object within Data - Is it still possible to access the properties of the list item?