Getting below error while clicking on button
This page has an error. You might just need to refresh it. Action failed: c:TestRateCard$controller$callMe [Cannot read property 'setParams' of undefined] Failing descriptor: {c:TestRateCard$controller$callMe}
<!-- Component One : TestRateCard-->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,force:appHostable" access="global" >
<aura:attribute name="accId" type="String" access="global"/>
Component One
<lightning:button label="Create Case" onclick="{!c.callMe }" />
</aura:component>
({
callMe : function(component, event, helper){
console.log('Enter Here');
var evt = $A.get("e.force:navigateToMyComponent");
console.log('Event '+evt);
var accountFromId = component.get("v.accId");
evt.setParams({
componentDef : "c:TestRateCardTwo" ,
componentAttributes : {
accountId : accountFromId
}
});
evt.fire();
}
})
<!-- Component Two : TestRateCardTwo-->
<aura:component implements="flexipage:availableForRecordHome,force:hasRecordId,force:lightningQuickAction,force:appHostable" access="global" >
<aura:attribute name="accountId" type="String" access="global"/>
Second Component
</aura:component>