【发布时间】:2020-11-19 23:17:48
【问题描述】:
我看过这个帖子:Using multiple instances of the same service。是否可以从父级到子级使用相同的多个服务实例?
例如,我在 ParentComponent 中有一个 ElementService,并且有 2 个该服务的实例
{ provide: 'instance1', useClass: ElementService},
{ provide: 'instance2', useClass: ElementService},
我应该如何在Child1Component 中使用instance1 和在Child2Component 中使用instance2?
【问题讨论】:
标签: angular service components angularjs-injector