javascript - Ember yield multiple actions into component -
i have checkout-form component has actions next, previous, submitform , selectdate. i’m able yield selectdate action this:
{{!-- checkout-form.js --}} <div class='checkout-form'> {{yield (action 'selectdate')}} </div> i’d able use checkout-form component this:
{{!-- order.hbs --}} {{#checkout-form |submitform, selectdate|}} {{checkout-field placeholder="full name" value=model.order.name}} {{!-- field component uses selectdate --}} {{checkout-form-actions action=submitform}} {{/checkout-form}} how go yielding multiple actions used inside of checkout-form.hbs?
option 1. can pass many arguments below
{{yield (action 'selectdate') (action 'submitform')}} read - https://guides.emberjs.com/v2.14.0/components/block-params/
and
{{!-- order.hbs --}} {{#checkout-form |selectdate, submitform|}} {{checkout-form-actions action=selectdate}} {{checkout-form-actions action=submitform}} {{/checkout-form}} option 2. can use hash helper,
{{yield (hash selectdate=(action 'selectdate') submitform=(action 'submitform')) }} and
{{#checkout-form |options|}} {{checkout-form-actions action=options.submitform}} {{/checkout-form}}
Comments
Post a Comment