Ever wanted to search an array within your template? Let’s say you have an array of users and you want the first user with first name “Joe”. Using the ember-composoable-helper addon, you can do this:
1 2 3 4 5 6 7 |
{{#with (find-by 'firstName' 'joe' people) as |person|}} {{#if person}} {{#link-to 'person' person}} This is a Joe {{/link-to}} {{/if}} {{/with}} |
You could use a variable instead the string ‘joe’ above to bind it to whatever first name you want.