how to call one lightning component from another code example
Example 1: calling lightning component from another lightning component
var evt = $A.get("e.force:navigateToComponent");
console.log('Event '+evt);
var accountFromId = component.get("v.recordId");
evt.setParams({
componentDef : "c:AffiliateSaveForm" ,
componentAttribute : {
accId : accountFromId
}
});
evt.fire();
Example 2: calling lightning component from another lightning component
console.log('Enter Here');
var evt = $A.get("e.force:navigateToComponent");
console.log('evt'+evt);
evt.setParams({
componentDef: "c:Component2"
//componentAttributes :{ }
});
evt.fire();