New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
strange behaviour after added a resolver #32453
Comments
Any information on this? @jyl1999 have you been able to solve it? I'm experiencing the same, and it broke my application's navigation seemly out of nowhere. |
An update: I don't know if it helps, but I was able to restore the correct behavior by removing this from the template: <ng-container *ngSwitchDefault>
<router-outlet></router-outlet>
</ng-container> |
…ones are destroyed There can be timing issues with removing an old outlet and creating a new one to replace it. Before calling `onChildOutletDestroyed`, the `RouterOutlet` will first check to ensure that it is still the one registered for that outlet name. Fixes angular#36711 Fixes angular#32453
…ones are destroyed There can be timing issues with removing an old outlet and creating a new one to replace it. Before calling `onChildOutletDestroyed`, the `RouterOutlet` will first check to ensure that it is still the one registered for that outlet name. Fixes angular#36711 Fixes angular#32453
…ones are destroyed There can be timing issues with removing an old outlet and creating a new one to replace it. Before calling `onChildOutletDestroyed`, the `RouterOutlet` will first check to ensure that it is still the one registered for that outlet name. Fixes angular#36711 Fixes angular#32453
…ones are destroyed (#46554) There can be timing issues with removing an old outlet and creating a new one to replace it. Before calling `onChildOutletDestroyed`, the `RouterOutlet` will first check to ensure that it is still the one registered for that outlet name. Fixes #36711 Fixes #32453 PR Close #46554
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Affected package
@angular/router
Is this a regression?
No
Short description
After adding a resolver in my angular app with dynamic templating, there are strange behavior : the component is not displayed and behavior of ngswitch is broken in specific cases.
Expected behaviour
After resolver is finished, the DOM must always display layout2 with home component.
Minimal Reproduction
https://stackblitz.com/edit/angular-raidlg
Exception or Error
no error messages
Environment
Chrome 76.0.3809.132 (64 bits), Safari 12.1.2 (14607.3.9)
Angular Version
8.0.0 and same result with latest version 8.3.2
Test case
Test case in success :
<ng-container [ngSwitch]="layout">
<app-layout1 *ngSwitchCase=1>
<app-layout2 *ngSwitchCase=2>
Test case in error :
<ng-container [ngSwitch]="layout">
<app-layout2 *ngSwitchCase=2>
<app-layout1 *ngSwitchCase=1>
Informations to know about test case
Modules & Components Hierarchy :
app.component.html : (2 before 1 is important)
app.component.ts
login.component.html
HomeResolver.ts
home-routing.module.ts
const routes: Routes = [{path : 'home', data : { layout : 2}, component : HomeComponent, resolve : {resultat : HomeResolver}}];
DOM and log results
DOM result after /login
DOM after home link clicked from login component (bug => layout2 added but login component not replaced by home component after end execution of resolver).
Logs from console
12:05:15.603 app.component.ts:18 AppComponent -> constructor
12:05:15.619 app.component.ts:23 AppComponent -> ngOnInit
12:05:15.621 layout1.component.ts:15 Layout1Component -> constructor
12:05:15.623 layout1.component.ts:19 Layout1Component -> ngOnInit
12:05:15.628 console.ts:15 Angular is running in the development mode. Call enableProdMode() to enable the production mode.
12:05:15.633 app.component.ts:26 Router event -> set layout : 1
12:05:15.639 login.component.ts:15 LoginComponent -> constructor
12:05:15.643 login.component.ts:19 LoginComponent -> ngOnInit
12:05:16.837 login.component.ts:22 LoginComponent -> onClick
12:05:16.838 app.component.ts:26 Router event -> set layout : 2
12:05:16.840 home.resolver.ts:17 HomeResolver -> resolve
12:05:16.844 layout2.component.ts:15 Layout2Component -> constructor
12:05:16.846 layout2.component.ts:19 Layout2Component -> ngOnInit
12:05:16.847 login.component.ts:15 LoginComponent -> constructor
12:05:16.847 login.component.ts:19 LoginComponent -> ngOnInit
The text was updated successfully, but these errors were encountered: