Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4829

Explaining the various ways to make actions and call them to a newcomer

$
0
0

@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:

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

Read full topic


Viewing all articles
Browse latest Browse all 4829

Trending Articles