This page is part of a static HTML representation of TriTarget.org at https://tritarget.org

Closure actions with helpers in Ember

Sukima11th April 2016 at 9:15am

I found there are times when you can perform the following with components:

{{my-component data=data
               shouldShow=showMyComponent
               action=(action (mut showMyComponent) false)}}

But it gets more complex in a helper like so:

<a href="#" {{action "myAction"}}>
  Open My Component
</a>

So how do you use the same trick above? Here is how:

<a href="#" {{action (action (mut showMyComponent) true)}}>
  Open My Component
</a>

{{my-component data=data
               shouldShow=showMyComponent
               action=(action (mut showMyComponent) false)}}