Providers
A component can configure dependency injection by defining the list of providers the component and its children may inject.
@Component({ selector: 'conf-app', providers: [Logger] }) class AppCmp { //... } @Component({ ... }) class TalksCmp { constructor(logger:Logger) { //... } }
In this example, we have the logger service declared in the app component, which makes them available in the whole application. The talks component injects the logger service. I will cover dependency injection in detail in Chapter 5, Dependency Injection. For now, just remember that components can configure dependency injection.