Skip to content

Pathless route consumes next path #26224

Closed

Description

@miginmrs

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

When we create a url using a relativeTo pathless ActivatedRoute, it does consider the next non empty path of this ActivatedRoute as a part of the url.

Expected behavior

RelativeTo is understood as a base for the relative url so its expected to not add its children as parent of the current commands.

Minimal reproduction of the problem with instructions

In this example: https://stackblitz.com/edit/pathless-route we can see that links are correct only when the parent route is path-full or it has no activated child.

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

The importance of the correction of this behavior is to allow using many routes on the same level including a pathless route as a default route (as for languages) with the same children.

Environment

Angular version: 6.1.9

Activity

  1. manklu commented on Oct 3, 2018

    @manklu

    @miginmrs If I understand you correctly, it will work if you correct your setting of the parent flag.

    Change

    const routes: Routes = [
      {path: "", component: RoutedComponent, data: {name: 'Pathless Parent', parent: true}, children},
      {path: "index", component: RoutedComponent, data: {name: 'Pathfull Parent', parent: true}, children},
    ]

    to

    const routes: Routes = [
      {path: "", component: RoutedComponent, data: {name: 'Pathless Parent', parent: false}, children},
      {path: "index", component: RoutedComponent, data: {name: 'Pathfull Parent', parent: true}, children},
    ]
  2. miginmrs commented on Oct 3, 2018

    @miginmrs
    ContributorAuthor

    @manklu Sorry if I was not very clear.
    Just to not create two different components ParentComponent and ChildComponent (and that is the real case), I passed the parent data property to the only one common component just to make the distinction. So its not possible to change this property because it means replacing the component in route with another which is not what we need.
    That a point. The other point is that what you proposed doesn't solve the incorrect links in the children.
    Btw, thanks for your comment 👍 I hope I am more clear now.

  3. added this to the needsTriage milestone on Oct 3, 2018
  4. jasonaden commented on Nov 20, 2018

    @jasonaden
    Contributor

    Thanks for the issue and PR. I'll try to get to the PR shortly and let you know.

  5. added a commit that references this issue on Dec 5, 2018
    0817bb2
  6. added a commit that references this issue on Dec 5, 2018
    8167bfc
  7. angular-automatic-lock-bot commented on Sep 14, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Sep 14, 2019
  9. added a commit that references this issue on Nov 20, 2026
    a8ce139
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions