# Nested component and sendAction

**URL:** <https://discuss.emberjs.com/t/nested-component-and-sendaction/4669>\
**Category:** Uncategorized\
**Created:** [March 29, 2014, 6:02pm UTC](https://discuss.emberjs.com/t/nested-component-and-sendaction/4669 "2014-03-29T18:02:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![diealp](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/diealp/32/14930_2.png) [@diealp](https://discuss.emberjs.com/u/diealp)\
**Post date:** [March 29, 2014, 6:02pm UTC](https://discuss.emberjs.com/t/nested-component-and-sendaction/4669/1 "2014-03-29T18:02:08Z")

</div>

Hi all,

I have a component which call himself… this is the template calling the component:

discussione.hbs

```
{{messaggi-discussione messaggi=this.messaggi inviarisposta="inviaMessaggio"}}

```

and this is the component template calling himself using other parameters:

components/messaggi-discussione.hbs

```
{{messaggi-discussione messaggi=messaggio.risposte inviarisposta="inviaMessaggio"}}

```

this is the action section in the component discussione\_controller.js

```
actions: {

    inviaRisposta : function (msgcall) {
        console.log('COMPONENT inviaRisposta');
        this.sendAction('inviarisposta', risposta);

    }
}

```

and this is the action section in the controller

```
actions: {
    inviaMessaggio: function (datimessaggio) {
        console.log('CONTROLLER inviaMessaggio');
    }
}

```

the problem is that the controller action inviaMessaggio is called only from the first level component… nested components doesn’t bubble to the controller… why? Surely im making something wrong… 😄

---

<div class="post-metadata">

**Author:** ![jasonmit](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/jasonmit/32/182_2.png) [@jasonmit](https://discuss.emberjs.com/u/jasonmit)\
**Post date:** [March 30, 2014, 8:20pm UTC](https://discuss.emberjs.com/t/nested-component-and-sendaction/4669/2 "2014-03-30T20:20:01Z")

</div>

I am having trouble replicating your issue. [Ember Latest - JSFiddle - Code Playground](http://jsfiddle.net/NQKvy/879/) Modify this jsfiddle to illustrate your problem.

---

<div class="post-metadata">

**Author:** ![diealp](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/diealp/32/14930_2.png) [@diealp](https://discuss.emberjs.com/u/diealp)\
**Post date:** [March 30, 2014, 10:52pm UTC](https://discuss.emberjs.com/t/nested-component-and-sendaction/4669/3 "2014-03-30T22:52:12Z")

</div>

Just modified to reply my situation… in the jsfiddle it works… i have to check something in my code… 😄

---

<div class="post-metadata">

**Author:** ![diealp](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/diealp/32/14930_2.png) [@diealp](https://discuss.emberjs.com/u/diealp)\
**Post date:** [April 4, 2014, 6:54am UTC](https://discuss.emberjs.com/t/nested-component-and-sendaction/4669/4 "2014-04-04T06:54:37Z")

</div>

After some days I check my code… and now it works… The problem was the #each iteration inside the component I was doing it:

Call the component from my template

```
{{messaggi-discussione messaggi=this.risposte}} 

```

The component iterate itself inside of him

```
{{#each messaggio in messaggi}}
  {{messaggi-discussione messaggi=messaggi.risposte}}
{{/each}}

```

Now I modify the code like this:

Iterate the component from the template:

```
{{#each risposta in this.risposte}}
  {{messaggio-discussione messaggio=risposta}}
{{/each}}

```

And the component iterate itself inside of him

```
{{#each risposta in messaggio.risposte}}
  {{messaggio-discussione messaggio=risposta}}
{{/each}}

```

And it works… note that messaggio is the singular for messaggi, risposta is the singular for risposte 😄Now the actions bubble to the controller.

Thanks for the support 😉
