5

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.

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();
}

Reference: https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_force_navigateToURL.htm

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?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.