Thanks to visit codestin.com
Credit goes to github.com

Skip to content

#each skips iteration on undefined values #1093

@florianpilz

Description

@florianpilz

If I have an template like this:

{{#each data}}
<span class="{{@key}}">{{this}}</span>
{{/each}}

Handlebars will render nothing when data is a dict entry with empty value, i.e. if I render above template with

template({data: {
    'first': null,
    'second': 'bar',
}});

Only second will be rendered, but first will be ignored.

I have made a JSFiddle to demonstrate the behaviour:

I have tested the behaviour with 4.0.0 and it is skipped there as well, so it's a problem introduced in 4.0.0.

Is this the intended behaviour now? It is not stated in the documentation and I can't see a good match in the release notes. It breaks our application, since we expect to have 7 <td> columns rendered by Handlebars, but 2 are missing due to null values.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions