I'm rendering components in the body of another component:
<c:test>
<input type="text" aura:id="fooBar" />
</c:test>
In this c:test
component I'm trying to access the inner element by it's aura id, but I can't find it:
c:test
<aura:component >
<aura:handler name="init" value="{!this}" action="{!c.find}" />
<button onclick="{!c.find}">find</button>
{!v.body}
</aura:component>
Controller:
find: function(cmp, event, helper) {
console.log(cmp.find("fooBar"));
}
Result: (on init, or when I click the button)
undefined
Is there a way to access Components inside the own body?
{!v.body}
in that case does exactly what you'd expect. renders whatever was entered between the beginning and end of the tag.