DEV Community

Cover image for How to Access Angular Parent Route Params
es404020
es404020

Posted on

How to Access Angular Parent Route Params

*Case Study *

Assume your app-routing.module.ts looks like this

Image description

*Problem Statement *

How do we access the accountNumber params from the children route.

*Possible Solution

Image description

This Works but it not the best solutions.

Best Solution

Update your app-routing.module.ts

Image description

paramsInheritanceStrategy: 'always' ==> This gives your access to parent params.Which make it easier to access parent params by doing

Image description

Thanks for reading you can support by Support link

Top comments (0)