Syntax
1{{ value | where:("published", true) }}2{{ value | where:("status", "draft") }}3{{ value | where:("author.name", "Ada") }}
Usage
- A quoted property path and comparison value are required. Dotted paths select nested own properties.
- Strings, numbers, booleans, and
null are compared by type and value. - Missing properties never match, including when the comparison value is
null. - Matching items retain their types and original order.
Examples
Open in Playground| Data | 1{2 "posts": [3 {4 "title": "One",5 "published": true6 },7 {8 "title": "Two",9 "published": false10 }11 ]12}
|
|---|
| Template | 1{{ posts | where:("published", true) | map:"title" | join:", " }}
|
|---|
| Output | 1One
|
|---|
Open in Playground| Data | 1{2 "items": [3 {4 "value": 15 },6 {7 "value": "1"8 }9 ]10}
|
|---|
| Template | 1{{ items | where:("value", "1") }}
|
|---|
| Output | 1[{"value":"1"}]
|
|---|