0

i have a app-routing.module where at specified path i lazyload another module.

{
        path: 'ROUTE1',
        loadChildren: () => import('../modules/modulename/modulename.module').then((val) => val.modulename),
    },

this is the routing of my child module:

 {
        path: '',
        component: modulenameComponent,
    },
    {
        path: 'register/:id',
        loadChildren: () => import('../../modules/secondomodule/secondomodule.module').then((val) => val.secondomodule),
    },

What i want now if i go to the path: register/:id is go to the secondmodule.routing at

  {
        path: 'register/:id',
        component: Nomecomponent,
       
    },

instead of

  {
        path: '',
        component: OtherComponent,
       
    },

Is possible in lazyloading pass to the loaded module a specified path?

1 Answer 1

1

In order to do what you want, your path would be

/register/123/register/123

since your route is a concatenation of all paths in hierarchy (root path + child path recursive)

Rethink your navigation.

Sign up to request clarification or add additional context in comments.

3 Comments

I have a direct method to navigate to this route and it work fine. But i have an external component, only for some user, that must pass to another module and only after insterted their code, they can redirect to this module. If instead of lazy loading, i call directly component it works, i could be use these method
Anyhow, you have yourself another module or you have to include this particular module somewhere else
It works, i just concatenate path and take the ID at the end of path so the result is a link to /register/save/123.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.