2

I'm creating a lightning component for our community using the community builder and I need to use the navigateToComponent event and it's not working. Any ideia why this event is not being fired? There's no error or message...

// here's the code where I try to navigate to another component var navigate = $A.get('e.force:navigateToComponent'); navigate.setParams({ componentDef : 'c:OnlineAPP', componentAttributes: { application: response.getReturnValue() } }); navigate.fire();

1 Answer 1

4

According to the Lightning Components Developer Guide, this functionality requires that the target component's access attribute be set to "global". It also notes that it is only available in Lightning Experience and Salesforce1. So it's not yet available for Communities.

If you try it outside of a community, you may find that what you have is working. That can at least let you know your code is able to function as intended.

One possible approach to "navigate" to a component within a community is to use a container component that includes {!v.body} in its markup, and use $A.createComponents() to dynamically create the desired component and set it as the {!v.body} of the container component.

See Dynamically Creating Components for more info on this.

1
  • Thanks so much! I was going to this route. I am half way building this component and your answer just confirm it.
    – Dudu Nato
    Nov 20, 2016 at 9:32

You must log in to answer this question.

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