You need to sign in to do that
Don't have an account?
Pankaj Singh 54
Navigation One component to another Component
<aura:event type="APPLICATION" description="Add to cart event."> <aura:attribute name="product" type="string"/> </aura:event> <aura:component implements="force:appHostable"> <aura:registerEvent name="addToCartEvent" type="c:AddToCart"/> <ui:inputText aura:id="n1" label="Number1" required="true"/> <ui:inputText aura:id="n2" label="Number2" required="true"/> <ui:button label="Sum" press="{!c.Add}"/> </aura:component> i try to navigate with attribute value but i am not able to navigate. ({ Add : function(component, event, helper) { debugger; var num1 = component.find("n1").get("v.value"); var num2 = component.find("n2").get("v.value"); var res = parseInt(num1) + parseInt(num1); res = res + ''; var evt = $A.get("e.force:AddToCart"); evt.setParams({ "product": res }); evt.fire(); } }) <aura:component > <aura:handler event="c:AddToCart" action="{!c.handleApplicationEvent}"/> <aura:attribute name="res" type="String" /> <!-- <aura:handler event="c:Result" action="{!c.handleApplicationEvent}"/>--> The result is {!v.res} </aura:component> ({ handleApplicationEvent : function(cmp, event) { debugger; var product = event.getParam("product"); // set the handler attributes based on event data cmp.set("v.res", ResultValue); } })
Please check the below blog from force base.com which is exactly similar to your requirement.
https://force-base.com/2016/01/04/how-to-navigate-from-one-component-to-another-in-lightning/
Follow the steps from the above blog and you will be able to achieve it.
Please mark this as solved if it helps.
Best Regards,
Nagendra.P