-
Notifications
You must be signed in to change notification settings - Fork 219
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
Multiple ShellComponent instance #109
Comments
Thanks for the nice issue template and the complete context information! |
Your welcome ! Some ideas:
For the third solution, the routing feature module could look like this:
You might also look the @ngx-i18n-router/core project: they use a custom routing module to dynamically translate application routes. For now, I haven't a clear idea of what is the best solution... |
I submitted an issue on Angular repo since it is not clear whether it is intended or not: angular/angular#18374 As for your ideas, the 3rd seems the cleanest one:
Thought I'm not sure how this may play with router lazy loading. The routes using |
I prefer the third solution too! But you need to play with Dependency Injection and I've not a clear idea of what is the best way to do it.
Without a custom DI, the ugly solution is to use a It seems that you can't dynamically append child routes with Angular router. The only way is to do it at runtime (you register somehow your feature routes and use the Maybe there is other solutions... I would like to keep a dedicated routing module by feature. We'll see the answer of the Angular team on the issue! |
I have asked for updates on the angular issue, since this issue is becoming quite old and still as problematic. I have tested successfully implementing a custom |
I'm submitting a...
Current behavior
When you navigate to a new route in your application, a new instance of ShellComponent is created. So if you have a custom component in ShellComponent template (e.g: SidebarComponent), current state of your component is lost on route switching.
The above picture show router tree of an Angular application generated with ngx-rocket. Children routes of feature modules are not shared by ShellComponent:
![router-tree-ngx-rocket](https://user-images.githubusercontent.com/23140206/28619516-085066f0-7209-11e7-8313-f64d285e85a0.png)
Expected behavior
Have a single ShellComponent for overall feature modules routes.
Minimal reproduction of the problem with instructions
console.log('*****INIT*****')
in ngOnInit() method of ShellComponent.http://localhost:4200
and switch between "Home" and "About" pages.Environment
The text was updated successfully, but these errors were encountered: