Skip to content

Router data doesn't update with ** matching #12603

@austinrmiller

Description

@austinrmiller

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

I tried to set up a route with something like:
{ path: '**', component: Foobar, resolve: {'myData': MyResolver} },

To allow URLs like
/foo/bar/baz/path/to/file.txt

And it all works fine on the first load - the resolved data derived from the full path is available with:
route: ActivatedRoute;
route.data.forEach((data) => {
console.log(data['myData']);
});

But then if the path is changed, the resolver is not called to recalculate the data, and the forEach body is not called again.

Expected behavior

The body of the forEach would be called any time the url changes.

Minimal reproduction of the problem with instructions

https://plnkr.co/edit/qc0dWTNzQOxgUnwWhlr5

What is the motivation / use case for changing the behavior?

I want to support fetching of things based on arbitrary paths during routing.

Please tell us about your environment:

Plunker with Chrome linux

  • Angular version: 2.0.X

    2.0.2

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

    all

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    all

  • Node (for AoT issues): node --version =

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions