Hello,
I am able to redirect from a lightning component to another lightning component using:
<c:SecondLighningComp recordId="{!v.recordId}" />
But I cannot redirect to second lightning component on click of a button.
<lightning:button label="Click me" variant="brand" onclick="{!c.handleYes}"></lightning:button>function:
handleYes: function(component, event, helper) {
var urlEvent = $A.get("e.force:navigateToComponent");
urlEvent.params({
componentDef: "c:SecondLighningComp",
componentAttributes: {}
});
urlEvent.fire();
}
The second component calls an apex class that uses ApexPages.currentPage().getParameters().get.(Multiple record values) which is returning null. I cannot change anything in the apex class.
How to approach this?
Hi shylesh,
Starting in API version 43.0, the force:navigateToComponent event is deprecated. For more information, see Components with Minimum API Version Requirements. We recommend implementing the lightning:isUrlAddressable interface on your target component and navigating to the component using lightning:navigation component with the standard__component page type instead. This generates a route in the format /cmp/{componentName}?myAttr=attrValue.
Migrate to lightning:isUrlAddressable from force:navigateToComponent