Using multiple instances of the same service
<p>I have a service, like this:</p>
<pre class="lang-js prettyprint-override"><code>@Injectable()
export class EditorService { ... }
</code></pre>
<p>And I have a component, like this:</p>
<pre class="lang-js prettyprint-override"><code>@Component({
  ...
  template: `&lt;child-component&gt;&lt;/child-component&gt;`,
  providers: [EditorService],
  ...
})
export class SomeComponent {
  constructor(
    private _appleEditorService: EditorService,
    private _pearEditorService: EditorService) {}
  }
</code></pre>
<p>As you may have noticed, this component has a child component:</p>
<pre class="lang-js prettyprint-override"><code>@Component({
  ...
  selector: 'child-component',
  ...
})
export class ChildComponent {
  constructor(
    private _appleEditorService: EditorService,
    private _pearEditorService: EditorService) {}
  }
</code></pre>
<p>As you can see, I want two instances of my <code>EditorService</code>: one will be used for editing apples and one for editing pears. However, the code above is not going to work, since there is no way for Angular to know which instance of <code>EditorService</code> is which as their variable names are private. <code>_pearEditorService</code> in <code>ChildComponent</code> might as well be referring to the same instance as <code>_appleEditorService</code> in <code>SomeComponent</code>.</p>
<p><strong>Question:</strong> How else then, can I use the same Angular2 service twice?</p>
<p><strong>EDIT:</strong> The point of my question is if it is possible using the same class. I know there are workarounds by actually creating a seperate class for every instance of the service, and even doing that with little code by inheritance. I just want to know if it can be done without.</p>