1
votes

I am trying to call an action from a parent component in my route view.

mychild.hbs

{{#parent as |wrapper|}}
    <button {{action "animate"}}>Login</button>
{{/parent}}

parent.hbs

<div>{{yield}}</div>

mychild route (no actions)

export default Ember.Route.extend(
});

mychild controller

export default Ember.Controller.extend({
});

parent component

export default Ember.Component.extend({

    actions: {
        animate() {
            console.log('ok');
        }
    },
});

How to call animate() from my component ? What am I doing wrong ?

1
Isn't it a typo? Opening bracket is #parent and its enclosing one is /animate-fadein - Pavol
@Pavol ooops ! missing syntax ;) - Totomakers
Could you write an Ember Twiddle to demonstrate the issue? - jelhan

1 Answers

1
votes

Changed the following code to this. Seems to be working.

<div>
    {{yield this}}
</div>

{{#my-component as |mc|}}
    <button {{action "doIt" target=mc}}>callDoIt</button> 
{{/my-component}}