I'm submitting a...
[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] (Maybe) bug report
[x] 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
Current behavior
When extend 'RouteReuseStrategy' with my reuse logic, only the child component
will be reused, the parent tree will be destroyed and recreated on every route change.
Expected behavior
When extend 'RouteReuseStrategy' with my reuse logic, i expect that not only the child component will be reused also the parent tree components.
Minimal reproduction of the problem with instructions
https://plnkr.co/edit/LQ2lgBrjWw6JeezdqNhl?p=preview
- type a number for simulate opening person to edit. (click on 'open person detail')
- change tab 'person'
- click on 'goto detail'
- type a number into the textarea -> parent component will show the value after living textarea
(share same service instance)
- change back to home tab -> change back to person tab
- typed number will be displayed in the child textarea (reused route) but parent doesn't have a number anymore even if typing a new number. (because service instance are not the same)
What is the motivation / use case for changing the behavior?
What i want to archive is that i can provide the same service instance via dependency injection to the router-outlet children and the children can interact with the parent component. (This cannot be done as global service, because the route will be created dynamically with an id in the url (every route has it's own state, see plunker demo)).
Environment
Angular version: 4.3.1
For Tooling issues:
- Node version: v6.11.1
- Platform: Windows
I'm submitting a...
Current behavior
When extend 'RouteReuseStrategy' with my reuse logic, only the child component
will be reused, the parent tree will be destroyed and recreated on every route change.
Expected behavior
When extend 'RouteReuseStrategy' with my reuse logic, i expect that not only the child component will be reused also the parent tree components.
Minimal reproduction of the problem with instructions
https://plnkr.co/edit/LQ2lgBrjWw6JeezdqNhl?p=preview
(share same service instance)
What is the motivation / use case for changing the behavior?
What i want to archive is that i can provide the same service instance via dependency injection to the router-outlet children and the children can interact with the parent component. (This cannot be done as global service, because the route will be created dynamically with an id in the url (every route has it's own state, see plunker demo)).
Environment