0

I'm including a CMP page inside my upper CMP simply trough tag

<c:ITA_IFM_1_PreventiveDetail />

Now, I would like to access on attributes' component through:

component.find("myId").set("v.value", "NO");

where the code is placed in the upper component controller js and 'myId' is instead mapped inside the included CMP. Is there any way to do this without using so many attributes from the upper page CMP to the included one passing values directly as parameters?

<c:ITA_IFM_1_PreventiveDetail myIdValue="NO"/>
2

Yes, you can do this. I wrote up an example:


Grand-Child

<aura:component >
    <aura:attribute name="hello" type="String" />
    {!v.hello}
</aura:component>

Child

<aura:component >
    <c:grandchild aura:id="hi" />
</aura:component>

Parent (As Application)

<aura:application >
    <aura:handler name="init" value="{!this}" action="{!c.init}" />
    <c:child aura:id="myid" />
</aura:application>

({
    init: function(component, event, helper) {
        component.find("myid").find("hi").set("v.hello", "Hello World");
    }
})
  • Great, it works! – Noomak Oct 6 '17 at 16:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.