How to Access Angular Parent Route Params

es404020 - Jan 19 '23 - - Dev Community

*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

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player