1

I am using NavigationMixin to navigate from one lwc to another lwc (app page in a custom tab) like this:

navigateToTabPage() {
    // Navigate to a specific CustomTab.
    this[NavigationMixin.Navigate]({
        type: 'standard__navItemPage',
        attributes: {
            apiName: 'TABNAME'
        }
    });
}

How can I add some parameters (for example an Id) and how can I handle this parameters in the new component ?

3

standard__navItemPage PageReference Type does not have any property other than apiName which is the unique name of the CustomTab. It means you can not pass anything other than that.

You should use standard__component PageReference Type. To make an addressable Lightning web component, embed it in an Aura component that implements the lightning:isUrlAddressable interface.

{
    type: 'standard__component',
    attributes: {
        componentName: 'c__MyLightningComponent'
    },
    state: {
        c__counter: '5'
    }
}

You can pass any key and value in the state object. The key must include a namespace, and the value must be a string.

| improve this answer | |
  • I would also point @Teemo_smr to this answer to a previous question that may include some relevant information. – Phil W Mar 25 at 13:39
  • @sanket kumar is this the only method? – Teemo_smr Mar 26 at 15:34

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.