Skip to content

Resolved data from parent is not available in child resolver #27936

@quasiunafantasia

Description

@quasiunafantasia

🐞 bug report

Affected Package

The issue is caused by package @angular/router

Is this a regression?

No info

Description

When there are 2 routes: child and parent, each has a resolved property, the data form the parent resolve is not available in child resolver (still available in ChildComponent though as expected)

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-issue-repro2-7xwxls?file=src%2Findex.html

🌍 Your Environment

Angular Version:




Angular CLI: 7.1.2
Node: 11.1.0
OS: darwin x64
Angular: 7.0.0
... animations, common, compiler, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.10.3
@angular-devkit/build-angular     0.10.3
@angular-devkit/build-optimizer   0.10.3
@angular-devkit/build-webpack     0.10.3
@angular-devkit/core              7.1.2
@angular-devkit/schematics        7.1.2
@angular/cdk                      7.0.1
@angular/cli                      7.1.2
@angular/compiler-cli             7.0.1
@angular/material                 7.0.1
@ngtools/webpack                  7.0.3
@schematics/angular               7.1.2
@schematics/update                0.11.2
rxjs                              6.3.3
typescript                        3.1.6
webpack                           4.19.1

Anything else relevant?

The resolve data from the parent can still be accessed as

class ChildResolver {
  resolve(route) {
    const parentData = route.parent.data;
    // ...
  }

but this looks like a hack

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions