Going the the lightning trailhead I'm at the challenge for camping list events. Everything is done in the CampingForm and all seems to work
In the form component
<aura:registerEvent name="addItem" type="c:addItemEvent"/>
the form controller validates and all works and calls this helper
createItem : function(component, citem) {
var createEvent = component.getEvent("addItem");
createEvent.setParams({"item":citem});
createEvent.fire();
}
All seems to work fine Now in the campinglist component I need to handle that event When I add this and try to save it
<aura:handler name="addItem" type="c:addItemEvent" action="{!c.handleAddItem}" />
I get this error
'Failed to save undefined: aura:handler has invalid name attribute value: addItem'
Any ideas why it doesn't like this. I'm doing pretty much the exact same thing that works in the expense app so I am at a loss as to why I cannot save this.
<aura:handler/>
syntax, before that can you confirm whetherc:addItemEvent
is an Application or Component event?<aura:handler name="addItem" event="c:addItemEvent" action="{!c.handleAddItem}" />
Does that work?