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
AkshiiiiiAkshiiiii 

Navigation to other component page

Can i write in Apex Controller class that I want to navigate to other component after a certain button is clicked? If so, How?
ANUTEJANUTEJ (Salesforce Developers) 
Hi Akshii,

So if I get the question correct you want to navigate from one component to another on button click if that is the case then you can try checking the below link: 

>> https://salesforce.stackexchange.com/questions/135450/how-to-navigate-from-one-lightning-component-to-another-lightning-component

One more simple example is present in the below link:

>> https://www.biswajeetsamal.com/blog/navigate-from-one-lightning-component-to-another-lightning-component/

Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.  

Thanks.
AkshiiiiiAkshiiiii
Hi Anutej,

Yes, I want to navigate from one component to other but for this, can I navigate from the Apex controller class of my original component?
If so, how do I code in the Apex Controller class for this?
ANUTEJANUTEJ (Salesforce Developers) 
so, we use apex as back end language to interact with objects and to operate on records we usually do not use apex to navigate components we generally do it from the lightning component controller after receiving a response from apex.

I tried searching but I have not found any examples where they are navigating from one lightning component to another using apex in most cases as previously mentioned they were using javascript controller.

Let me know if it helps you and close your query by marking it as the best answer so that it can help others in the future.  

Thanks.