Tip
I already mentioned the ember-composable-helpers addon in the last tip and it has so much awesome features. I really like the “map” helper because you can do this:
1 2 3 |
{{#each (map (action "getName") users) as |fullName|}} {{fullName}} {{/each}} |
This is basically calling the getName action which item in the users array. Without the helper, you would have to do it this way.
1 2 3 |
{{#each users) as |user|}} {{user.fullName}} {{/each}} |
But then you will have to create a computed property on the user object. I am sure you can see how powerful map is. Enjoy.
Credits & Links
Thank you @dockyard for https://github.com/DockYard/ember-composable-helpers#pipe
Rock and Roll with Ember 1k Customers
Balint is celebrating 1000 customers for his book, Rock and Roll with Ember.js, he launched an amazing giveaway at https://gleam.io/oi3Hc/rock-and-roll-with-ember-1k-customers-giveaway – check it out for your chance to win 5 programming books and other cool prizes.
Share Your Expertise
Let us know if you have a good ember tip (you will get full credit)
If you are enjoying my daily tips please spread the word with this one-click tweet.
If you do NOT like the tips then please reply to this email and let me know how I can improve them.