Basic Navigation
- lightning:navigation
-
To navigate to a page or component, use the navigate(pageReference, replace) method from lightning:navigation. This approach is a substitute for a navigateTo* event, and both are supported.
When you navigate to a page reference from a modal, such as from a component that’s enabled for quick actions, the modal isn’t automatically closed by default. To automatically close the modal when navigating to another page reference, set replace to true.
To generate a URL in your component, use the generateUrl() method in lightning:navigation to resolve the URL. - lightning:isUrlAddressable
- To enable a component to navigate directly via a URL, add the lightning:isUrlAddressable interface to your component.
pageReference provides a well-defined structure that describes the page type and its corresponding attributes. pageReference supports the following properties.
Property | Type | Description | Required? |
---|---|---|---|
type | String | The API name of the pageReference type, for example, standard__objectPage. | Y |
attributes | Object | Values for each attribute specified by the page definition, for example, objectAPIName or actionName. | Y |
state | Object | Parameters that are tied to the query string of the URL in Lightning Experience, such as filterName. The routing framework doesn’t depend on state to render a page. Some page reference types support a standard set of state properties. You can also pass non-standard properties into state as long as they’re namespaced. |