question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Angular router / auxiliary routes working once, bug (?) after

See original GitHub issue

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

<div>
  <a [routerLink]="['emails']">Emails</a>
  <a [routerLink]="['contacts']">Contacts</a>
  <a [routerLink]="[{outlets: {aux: ['auxiliary']}}]">Open an auxiliary route</a>
</div>

<router-outlet></router-outlet>
<router-outlet name="aux"></router-outlet>

So far, it’s nearly fine.

  • /emails is diplaying fine
  • /contacts is diplaying fine
  • /emails(aux:auxiliary) is diplaying fine at loading
  • /contacts(aux:auxiliary) is diplaying fine at loading

When the auxiliary is in URL, it’s ok the first time we reach it.
But then, if I click on <a [routerLink]="['emails']">Emails</a>, my aux outlet is not displayed anymore even tho the URL is still http://localhost:4200/emails(aux:auxiliary).

So my question is, how can we change the primary URL, without changing auxiliary routes ? (if no auxiliary, just go to new URL, if auxiliary, go to URL + auxiliary).

I tried :

<a [routerLink]="['emails', {outlets: {aux: ['/']}}]">Emails</a>
<a [routerLink]="['contacts', {outlets: {aux: ['/']}}]">Contacts</a>

and also

<a [routerLink]="['emails', {outlets: {aux: ['./']}}]">Emails</a>
<a [routerLink]="['contacts', {outlets: {aux: ['./']}}]">Contacts</a>

But it’s not working either.

Expected behavior

Stay on current primary route without changing auxiliary.

Reproduction of the problem

git clone https://github.com/maxime1992/angular2-nrgx-demo.git
git checkout auxiliary-route
npm i
ng serve

Please tell us about your environment:

Ubuntu 16.04 Node 6.5.0

  • Angular version: 2.0.0-rc.X

    angular-cli: local (v1.0.0-beta.14, branch: master)

  • 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 ]

    Chromium 52.0.2743.116

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

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

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
zhentian-wancommented, Oct 4, 2016

+1

1reaction
vsavkincommented, Oct 25, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular auxiliary routing not working from within modules
I'd like to use Angular auxiliary routing for a (very large) administration tool side menus (using 7.2.X Angular branch). After several days ...
Read more >
Angular Router: Child Routes, Auxiliary Routes, Master Detail
Learn how to use the Angular Router, avoid common pitfalls, learn Child Routes, Auxiliary Routes, setup a Master Detail Routing Scenario.
Read more >
Router tutorial: tour of heroes - Angular
This tutorial provides an extensive overview of the Angular router. In this tutorial, you build upon a basic router configuration to explore features...
Read more >
Mastering RouterLink - Briebug Blog
We're going to keep it simple with the following route configuration. ... routerLink attribute to the element and give it a valid Angular...
Read more >
How To Get Route Path Parameters In Non-Routed Angular ...
Imagine a following situation. We have an Angular application with some route and this route defines a path parameter using :id in its...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found