I know how to inject a service into a component (via @Component), but how can I use DI to pass around services outside of components?
In other words, I don\'t want t
First You need to provide your service
You could provide it either in the bootstrap method:
bootstrap(AppComponent,[MyFirstSvc]);
or the on the app component, or in any other component, depending on your needs.:
@Component({
...
providers:[MyFirstSvc]
}
...
then just inject you service using the constructor :
export class MySecondSvc {
constructor(private myFirstSvc : MyFirstSvc ){}
}