Skip to content

redirectTo with named outlet doesn't work #12740

Closed

Description

@zoechi

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

{ path: '', redirectTo: '/list(full:full)', pathMatch: 'full', }
gives me

unpkg.com/@angular/core/bundles/core.umd.js:3004 EXCEPTION: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'list(full%3Afull)'

Expected behavior

should navigate to /list(full:full)

Minimal reproduction of the problem with instructions

https://plnkr.co/edit/BoX4gRVKF4tczR3fOeTX?p=preview

Replace the current default route (redirectTo) with the commented out to get above exception
Navigating to /list(full:full) works with router.navigate() - click on the [navigate] button

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

Please tell us about your environment:

Only tried in Plunker in Chrome

  • Angular version: 2.0.X
  • 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 ]

Chrome

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

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

Activity

  1. steffenstolze commented on Nov 9, 2016

    @steffenstolze

    I'm facing the same problem here and want to contribute something to "What is the motivation / use case for changing the behaviour"

    My application is divided into two columns.
    First one contains sidebar and beneath it an "action area" (outlet: actions) where typical actions like "Save this and that" are located. The second one is the main content area (outlet: primary).

    The actions area depends on the main content - obviously. If you are in Customers pages you want a different actions-component (e. g. CustomersEditActionsComponent) in that actions outlet than in Settings pages (e. g. SettingsActionsComponent).

    When a user navigates to 'www.myapp.com/settings', I actually want to router to navigate to 'www.myapp.com/settings/core(actions:settings-actions)' - per default. But this won't work:

    [{
        path: 'settings', component: SettingsComponent, canActivate: [AuthGuard],
        children: [
          { path: '', redirectTo: '/settings/core(actions:settings-actions)' , canActivate: [AuthGuard] },
          { path: 'core', component: SettingsCoreComponent, canActivate: [AuthGuard] },
          { path: 'roles', component: SettingsRolesComponent, canActivate: [AuthGuard] },
          { path: 'user', component: SettingsUserComponent, canActivate: [AuthGuard] }
        ]
      }]
    

    That's necessary because normal users don't type those aux-routes-bracket-stuff. They know "If I type /settings I should come to Settings, if I type /profile I should come to my profile..." for years now. Problem is: route would open, actions outlet would be empty, application does not work as expected.

    thank you!

  2. DzmitryShylovich commented on Nov 15, 2016

    @DzmitryShylovich
    Contributor

    Related to #12371

  3. self-assigned this
    on Nov 16, 2016
  4. added a commit that references this issue on Nov 22, 2016
    09226d9
  5. angular-automatic-lock-bot commented on Sep 10, 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.

  6. locked and limited conversation to collaborators on Sep 10, 2019
  7. added a commit that references this issue on Nov 20, 2026
    f8f5d7c
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions