I'm trying to handle the following task:
a component creates on the init-event a component dynamically
CREATOR COMPONENT
.cmp<aura:handler name="someEvent" event="someEvent" action="{!c.someEventHandler}"/>
<aura:handler name="init" value="{!this}" action="{!c.createDetail}"/> {!v.body} </div>
.controller
createComp : function(component, event, helper){
component.set("v.body", []);
$A.createComponent(
"c:someComp",
{},
function(newComp){
var newCompBody = component.get("v.body");
newCompBody.push(newComp);
component.set("v.body", newCompBody);
}
);
},
someEventHandler : function(component, event, helper){
console.log("event caught");
}
This works just fine. A component event is fired in the component that got created dynamically. This event should be handled by the component that created the other component but its not working ... (console.log does not show up)
CREATED COMPONENT
.cmp<aura:registerEvent name="someEvent" type="c:someEvent" />
.controller
// action for a button
someAction : function(component, event, helper){
var someEvent = component.getEvent("someEvent");
someEvent.fire();
console.log("save event fired");
}
Any suggestions?
Thanks!