You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@last element in nested each refers to the parent item ( C# ) #243
changed the title [-]@last element in nested each refer to parent item ( C# )[/-][+]@last element in nested each refers to the parent item ( C# )[/+]on Jan 26, 2018
In Handlebars.js, @last is not set when iterating an object. As the documentation says: "When iterating over an object only the @FIRST is available."
If the data is an array (or list), this works as expected.
var rowData = new [] {"A","B","C","D","E","F","G"};
var data = new
{
header = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" },
rows = Enumerable.Repeat(rowData, 7)
}
Maybe @last should be explicitly unset somehow, instead of having the parent value? So that it was always false? But that wouldn't solve the authors problem anyway.
Activity
[-]@last element in nested each (Handlebars) C#[/-][+]@last element in nested each refer to parent item ( C# )[/+][-]@last element in nested each refer to parent item ( C# )[/-][+]@last element in nested each refers to the parent item ( C# )[/+]slahn commentedon May 4, 2018
In Handlebars.js,
@lastis not set when iterating an object. As the documentation says: "When iterating over an object only the @FIRST is available."If the data is an array (or list), this works as expected.
Maybe
@lastshould be explicitly unset somehow, instead of having the parent value? So that it was always false? But that wouldn't solve the authors problem anyway.oformaniuk commentedon Dec 13, 2019
Bug is located in
Iteratemethod: https://github.com/rexm/Handlebars.Net/blob/a37a08b28469feec565304e27dabac64c554ff51/source/Handlebars/Compiler/Translation/Expression/IteratorBinder.cs#L239I'd try to find some time and create a PR.
#243: Support `@last` for properties enumeration (#330)
Extreme refactoring/enhancements