[SalesForce] boatselected event handler

I am on step 6 (Display Boat Details) of lightning component framework specialist superbadge, and created a boatselected event. I am firing the event from BoatTile component and receiving it in the onBoatSelected handler method of BoatDetails component.

When I checking the console output, I am not seeing the receiving log entry from "BoatDetailsController.js". Is there a way to check whether the application event is correctly fired from Tile component without the console.log

BoatTile.cmp

<aura:registerEvent name="BoatSelected" type="c:BoatSelected"/>

BoatTileController.js

var boatselected = component.get("v.boat");
var boatSelectedEvent = $A.get("e.c:BoatSelected");
boatSelectedEvent.setParams({ "boatselected" : boatselected });
console.log("Firing BoatSelected Event");
boatSelectedEvent.fire();

BoatDetails.cmp

<aura:handler name="BoatSelected" event="c:BoatSelected"
        action="{!c.onBoatSelected}"/>

BoatDetailsController.js

onBoatSelected : function(component, event, helper) {
        console.log("Receiving BoatSelected Event");
    }

Best Answer

You are firing an application event and the application event handlers should not have a name attribute below

<aura:handler event="c:BoatSelected" action="{!c.onBoatSelected}"/>

From documentation here

The handler for an application event won’t work if you set the name attribute in . Use the name attribute only when you’re handling component events.