I wanna fire component's actions from template inserted in block-form component like this:
{{#block-component}}
<p> HTML inserted in block form </p>
<p> How trigger a action from block-component (not your parent) from this scope? </p>
<p {{action 'actionFromBlockComponent'}}> Fire component's action!!! </p>
{{/block-component}}
The block params enabled in Ember 1.10.0 can help me with this? Or this demand is impossible?
With the new block params in 1.10.0 this is possible by doing the following:
{{#block-component as |component|}}
<p> HTML inserted in block form </p>
<p> How trigger a action from block-component (not your parent) from this scope? </p>
<p {{action 'actionFromBlockComponent' target=component}}> Fire component's action!!! </p>
{{/block-component}}
Note the target of the action set to the block param.
The template of the block-component should contain this:
{{ yield this }}
It simply passes the component itself to be used as a block param for any template using this component.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With