Skip to content

Child route data is not inherited from parent unless 'runGuardsAndResolvers' returns true #51934

@Erbenos

Description

@Erbenos

Which @angular/* package(s) are the source of the bug?

router

Is this a regression?

No

Description

While I was figuring out a way to trigger resolver only for certain route on route navigation (see #31843), I found this bug (see linked stackblitz), when even though Angular invokes the resolver as expected, the children won't get their @input() bound to the new value until the resolver for the specific child runs.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-exaecl?file=src%2Fmain.ts

  1. goto route "a/b"
  2. click "Route B"'s "refresh route A resolver", which navigates to route "a/b" and custom RunGuardsAndResolvers strategy causes route's "A" resolver to run
  3. observe that component of "a/b" doesn't obtain the new value, but component of "a" does.
  4. click "Route B"'s "refresh route B resolver", which navigates to route "a/b" and custom RunGuardsAndResolvers strategy causes route's "B" resolver to run
  5. observe that component of "a/b" obtains both new value for "resolver B" AND new value for "resolver A" (cause only now the value gets updated even though "resolver A" isn't run anew)

Please provide the exception or error you saw

There is no error.

Please provide the environment you discovered this bug in (run ng version)

Angular 16.0.1

Not sure how I can run the ng version on stackblitz, can't provide more info.

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions