1

Component1

<aura:component implements="force:appHostable">
    <aura:attribute name="accountid" type="String" />
    <ui:inputNumber aura:id="test1" label="Name" />
    <ui:button label="Navigate" press="{!c.Naviagte}" />
</aura:component>
({
    Add: function(component, event, helper) {
        var get_name = component.find("testt1").get("v.value");
        var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
            componentDef: "c:Component2",
            componentAttributes: {
                accountid: get_name
            }
        });
        evt.fire();
    }
})

Component2

<aura:component implements="force:appHostable">
    <aura:handler name="init" value="{!this}" action="{!c.doInit}" />
      Hello
</aura:component>

Controller

doInit: function(component, event, helper) {
    var ResultValue = event.getParam("accountid");
    // it navigate fine but i am not able to get pass attribute value here
}
6
  • Hi pankaj, welcome to SFSE! Please take the time to visit the Help center and read How do I ask a good question. Please don't just do a "code dump" on us. Instead, tell us where you're stuck and what you're having trouble with, including what you've tried that didn't work. Once you do, the more likely it is that someone will respond to your question with an answer you'll find helpful.
    – crmprogdev
    Commented Jun 18, 2016 at 12:50
  • thanks sir,but i try to get passed attribute value from component one in component2 in many way i am not able to get it. Commented Jun 18, 2016 at 13:21
  • possible duplicate of http://salesforce.stackexchange.com/q/66954/20830
    – Praveen
    Commented Jun 18, 2016 at 15:22
  • e.force:navigateToComponent is an undocument event which is not officially supported by Salesforce.Use $A.createComponent to create components as given in the above link's answer
    – Praveen
    Commented Jun 18, 2016 at 15:25
  • thanks praveen sir, i try your given link but still my problem not solved Commented Jun 18, 2016 at 15:47

0