8

I'm trying to build an app with lightning out (in my case they are hosted in VF Pages) but I was wondering if there is a way to navigate from component to component like with $A.get("e.force:navigateToComponent") inside the One app.

If not what would be the best way to implement it ? Should I use one lightning component per page or dynamically destroy and create component as the user is completing tasks ?

The thing that worries me in the second option would be the use of the navigator back button and how to handle it.

1 Answer 1

3

There are 2 to 3 ways i can think of:

1.Group components based on functionalities and create pages accordingly and handle navigation between VF pages

2.In a single container component have the child components inside aura:if and then use the if condition to open up visibility based on the wizard or functionality step

3.Using dynamic component creation and destruction based on your criteria

$A.get("e.force:navigateToComponent") doesnt work because it looks up the one.app and in lightning out scenario the container is VF.

In one of our use cases we had the same scenario(Navigator back), what we did was to logically segregate the components based on pages and navigation would be triggered based on that.

It also a user training thing if users are given navigation options within the page like left hand side tab/menu they should click that to goto the previous sections.

There isn't a fool proof way to control browser back button so its better not to go that way.

My personal preference would be a combination of 1st and second approach. Logical segregation and within the page use aura:if to conditionally show hide.

we can also store the section name which will map to a component in the segregation and store it in the back-end SF object and if users land on the page again we can directly open up that section using aura:if based on the value stored in the backend.

2
  • I guess that's the better solution yes. But btw do you know if there any more ressources online about Lightning out (e.g blogpost or examples,...) ? Because the documentation provided by Salesforce is quite basic on the subject. Commented Jul 18, 2017 at 10:40
  • @NordineHammache - I found this youtube video, youtube.com/watch?v=qL0wO5RZUpE, I couldnt find anything else
    – RedDevil
    Commented Jul 18, 2017 at 10:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .