@xcambar wrote:
Hi, I’m having difficulties explaining the subtleties behind Ember’s actions API(s?). Between
{{my-component myAction="anAction"}}
{{my-component myAction=(action "anAction")}}
the difference is fairly simple: “Use the second form as it allows for better control” (return value, etc…).
But add to that the component’s syntax, with either:
this.attrs.anAction()
(which looks like an incidental feature)this.get('anAction')()
(which is ugly)this.sendAction('anAction')
(which does not benefit from closure actions goodness)It’s very hard to give to newcomers a clear mental model of what they should do and how they should do it.
Add up that:
- this RFC that newcomers wouldn’t read https://github.com/emberjs/rfcs/blob/master/text/0050-improved-actions.md
- https://github.com/DockYard/ember-route-action-helper
- and mostly https://github.com/martndemus/ember-invoke-action
and you are in for a very confusing training session.
So, I wanted to ask if there were established best practices (beyond https://guides.emberjs.com/v2.14.0/components/triggering-changes-with-actions/) and/or a definitive guide and/or a definitive addon.
If someone had an addon as useful to the actions as
ember-native-dom-helpers
is useful to testing, I’d be eternally (yes, eternally!) grateful!All the best to you all, dear Embereñas y Embereños!
Posts: 1
Participants: 1