function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Vandana Rattan 4Vandana Rattan 4 

Lightning App Redirection

I have built a Lightning app containing a login form component. Now when user clicks on Login button I have to take the user to Registration Page another component. How can I achieve this? I went through Lightning documemntation and came across force:navigateToURL. But what should I specify as URL for the Registration Page?

Or will I have to create a separate app containing Registration page? Kindly help.

Regards
Best Answer chosen by Vandana Rattan 4
Vandana Rattan 4Vandana Rattan 4
Thanks Gaurav,

I had to implement it by creating event handler, registering and then firing the event.

All Answers

Gaurav KheterpalGaurav Kheterpal
You don't need to create separate Lightning apps for this. Just use
 
sforce.one.navigateToURL('Your component URL here');

to redirect to the approprirate place.

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker



 
Vandana Rattan 4Vandana Rattan 4
Thanks for your reply Gaurav. Can you please help me understand how to form the lightning component URl?
I know the URL of a lightning app is :-
cs8.lightning.force.com/[ns]/[AppName].app

How can I form the compnent URL to be passed to navigateToURL function?
Gaurav KheterpalGaurav Kheterpal
I stand corrected - you would do this using the  e.force:navigateToComponent method. Try this

In your markup
 
<ui:button label="ATTENDANCE" press="{!c.navigateToRollCall}"/>
In your controller, do something like
 
navigateToRollCall : function(component, event, helper) {
    var evt = $A.get("e.force:navigateToComponent");
        evt.setParams({
            componentDef: "c:AttendanceRollCall",
            componentAttributes: {
                programId: component.get("v.program.Id")
            }
        });
    evt.fire();    
}

If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others and improve the overall quality of Discussion Forums.

Gaurav Kheterpal
Certified Force.com Developer| Salesforce Mobile Evangelist| Developer Forums Moderator| Dreamforce Speaker




 
Vandana Rattan 4Vandana Rattan 4
Thanks Gaurav,

I had to implement it by creating event handler, registering and then firing the event.
This was selected as the best answer
Anshuman Chauhan 10Anshuman Chauhan 10
Hi,

 I am able to navigate to the new component by using "e.force:navigateToComponent" but attributes are not getting passed. Please suggest.

Regards
 
Vandana Rattan 4Vandana Rattan 4
Hi Anshuman,

Apologies for a delayed response. You would have to make your attributes Application level instead of component level. I used this strategy to pass attributes from 1 component to other. But now strangely e.force:navigateToComponent is no longer working.

Regards,
Vandana
 
Anshuman Chauhan 10Anshuman Chauhan 10
Yes, Same problem. see this link https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BKZbIAO.
B kldB kld
@VandanaRattan4

Hi Vandana,
Could you please send me the flow of the execution that what you did for force:navigateToURL.

I have stucked in the same place...

Please guide me...