3

In my Lightning Project i have 2 different components (Login Component,Home Component). What i want is when the user click the login button. The user will redirect to the home component.

Danryl Tigol Carpio
  • 639
  • 2
  • 13
  • 25
  • 1
    Check this out: https://salesforce.stackexchange.com/questions/56256/how-to-set-up-views-and-navigation-in-lightning And : http://salesforce.stackexchange.com/questions/66513/navigation-between-components-in-lightning?lq=1 – Moshe Karmel Aug 20 '15 at 13:31
  • Did you apply link of scenarios to your code ?.. Will you give a simple complete working code for that ? regards – Danryl Tigol Carpio Aug 25 '15 at 01:55
  • check this perfect example https://force-base.com/2016/01/04/how-to-navigate-from-one-component-to-another-in-lightning/ – cloudy-ritz Aug 04 '17 at 04:04

1 Answers1

0

Try this

In Login Component component

<ui:button label="Navigate to foo" press="{!c.navigateToHome}"/>

In Login controller

navigateToHome : function(component, event, helper) {
var evt = $A.get("e.force:navigateToComponent");
    evt.setParams({
        componentDef: "c:YourHomeComponent",
        componentAttributes: {
            myAttribute: component.get("v.someAttribute")
        }
    });
    evt.fire();    
}
Tariq
  • 898
  • 7
  • 19