Tawani
Tawani

Reputation: 11208

How do you get the Route Params from a Lazy-Loaded child component (in Angular 7)?

Angularr route param issues How can you get the route params (e.g. companyId in the picture) from a child component? So far, the following has not worked:

this.companyId = this.route.snapshot.params.companyId;
if (!this.companyId)
    this.companyId = this.route.parent.snapshot.params.companyId;

StackBlitz

Upvotes: 0

Views: 711

Answers (1)

Martin Paucot
Martin Paucot

Reputation: 1251

Add the option {paramsInheritanceStrategy: 'always'} to your Router.forRoot().

Upvotes: 2

Related Questions