Discussions

Ask a Question
Back to All

How to Filter Each Array

How would I only show content that matches a specific setting?

For example, in an {{#each Person}} I would like to only include Person with a specific matching attribute, such as Person.Department = DepartmentName.

Admin

To access a setting from in a each you need to prefix withh ../ to access parent context.

More info : https://handlebarsjs.com/guide/expressions.html#changing-the-context

{{#each Person}}

{{equal Person.Department ../Settings.DepartmentName }} hello {{/equal}}

{{/each}}

ο»Ώ