How can I redirect from one Lightning page to another lightning page through a click on a component link? I can only find answers for navigating from one lightning component to another lightning component.
Asked
Active
Viewed 1.9k times
5
-
By "Lightning Page" do you mean an app builder page? – pchittum May 07 '15 at 08:53
-
Yes. Or go from component link to an App Builder Page. – Tyler May 07 '15 at 15:53
-
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToURL.htm – zeo2396 Jul 07 '15 at 17:01
2 Answers
4
The force:navigateToURL event is used to navigate to a URL.
Use a relative url to stay in your current app and go to a different page.
goToNewPage: function(component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "/newPage"
});
urlEvent.fire();
}
Use an absolute URL to open an external website in a new browser tab.
goToExternalSite: function(component, event, helper) {
var urlEvent = $A.get("e.force:navigateToURL");
urlEvent.setParams({
"url": "http:www.google.com"
});
urlEvent.fire();
}
Brett Nelson
- 345
- 1
- 5
3
You don't go from page to page.. you load components in and out of the current application context.
component.set("v.body",newComponent);
here is a good discussion.. How to set up views and navigation in Lightning?
Benjamin Pirih
- 2,384
- 17
- 28