Skip to content

Childrouting inside auxiliary outlet works only in very specific cases #26672

Closed

Description

@luckylooke

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

Routing inside auxiliary routes is broken.

Expected behavior

Same routing experience as inside primary routers. There should be no difference between routing inside primary router, auxiliary or nested routes. Each child route should be should behave consistently whatever parent outlet is.

Minimal reproduction of the problem with instructions

Angular 6.1.10
https://stackblitz.com/edit/angular-routing-default-aux?embed=1&file=src/app/app.routing.module.ts
Angular 7.0.0
https://stackblitz.com/edit/angular-routing-default-aux-a7?embed=1&file=src/app/app.routing.module.ts

Click on navigation links

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

Consistency in behavior of routing will prevent unexpected outputs.

Environment


Angular version: 6.1.10, 7.0.0


Browser:
- [ x] Chrome (desktop) version 69.0.3497.81 OS: Win7
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
 
For Tooling issues:
- Node version: XX  
- Platform:  

Others:

Activity

  1. added this to the needsTriage milestone on Oct 26, 2018
  2. jasonaden commented on Nov 27, 2018

    @jasonaden
    Contributor

    @luckylooke Can you please add some more detail? Such as what actions you want me to take when reproducing and what the expected result should be? It looks like you put together some good samples, but your steps to reproduce don't tell me anything useful and the general statement that "Routing inside auxiliary routes is broken" also doesn't help as it doesn't say how it's broken or what exactly you're running into.

  3. luckylooke commented on Dec 6, 2018

    @luckylooke
    Author

    Yes I am really sorry I should review my question after some time to get 3rd person view on it :) Now I see how badly I wrote it, I did not left any context here or real steps.

    Situation:
    AppComponent ( root, have two outlets one unnamed and one named 'secondary' outlet )
    AuxComponent ( has one unnamed outlet )
    OneComponent, TwoComponent, ThreeComponent ( basic components, nothing special )
    All routes configuration is in app.routing.module.ts.

    Ok, so at first it loads in empty route state:
    OneComponent is loaded into root primary outlet and AuxComponent is loaded in secondary outlet. As AuxComponent have nested outlet with children routes defined in router config, redirection should be applied to go to 'three' route. This is not happening.

    Navigating to '/two' ([routerLink]="['two']"), pretty same scenario is expected in secondary outlet. Again no redirection happens.

    Navigating explicitly to '/(secondary:three)' ([routerLink]="['', {outlets:{secondary:['three']}}]") works.
    But navigating explicitly to '/two/(secondary:three)' ([routerLink]="['two', {outlets:{secondary:['three']}}]") does not, it throws error that it cannot match segment 'two'.

    Navigating from '/(secondary:three)' to '/two' keeps secondary outlet untouched (ThreeComponent displayed), url is changed to '/two(secondary:three)' as expected.

    But navigating from '/(secondary:three)' to '' or '/' removes navigation from secondary outlet. I am expecting same behaviour as for '/two' that secondary routing will be kept untouched.

    Probably it will be better after applying recent fix 20cef50 by Igor.

    Maybe also Maxim's #25483 could help.

    Thank you for your time! You are awesome! :)

  4. jasonaden commented on Dec 18, 2018

    @jasonaden
    Contributor

    Thanks for the update! We tried to merge the commit 20cef50 which was actually submitted by a community member.

    We had an issue internally that caused that commit to be reverted, but we will be looking at getting it merged again as soon as possible.

    I'll take a look at the additional info. Thanks!

  5. modified the milestones: needsTriage, Backlog on Dec 5, 2019
  6. added
    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
    and removed on Oct 1, 2020
  7. atscott commented on Nov 17, 2020

    @atscott
    Contributor

    Closing as duplicate of #13523 for the

    <p><a [routerLink]="['two', {outlets:{secondary:['three']}}]">Navigate to /two(secondary:three)</a> = NOK(cannot match "two" segment)</p>
    

    This should instead be:

    a [routerLink]="[{outlets:{primary: 'two', secondary:['three']}}]">Navigate to /two(secondary:three)</a> = NOK(cannot match "two" segment)</p>
    

    While the empty path child redirect is somewhat similar to #10726 but slightly different. In this case, I'm not sure the empty path parent with an empty path child redirect in the secondary outlet is a good idea - this effectively creates a situation where you would not be able to close the outlet. If you have a burning desire to see this added, please submit a new issue that is specific to that request.

  8. angular-automatic-lock-bot commented on Dec 19, 2020

    @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.

  9. locked and limited conversation to collaborators on Dec 19, 2020
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