'Inject a child provider to the parent in angular?
I would like to add a feature in a parent component using the activated child's provider.
I've got two children like so :
Child1.module.ts
providers: [
{ provide: Service, useClass: Service1},
],
Child2.module.ts
providers: [
{ provide: Service, useClass: Service2},
],
Now, in the parent module, i want to provide Service1 or Service2 depending on which child is activated, maybe with a provide:Service, useFactory: (route: ActivatedRoute) or something ?
Edit :
Here a quick picture of the idea :

Thanks !
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
