So far we have only discussed Dependency Injection in general, but Angular has some constructs, or decorators, to ensure that Dependency Injection does its job. First imagine a simple scenario, a service with no dependencies:
export class SimpleService {}
If a component exists that requires an instance of the service, like so:
@Component({ selector: 'component'})export class ExampleComponent { constructor(srv: Service) {}}
The Angular Dependency Injection system comes in and attempts to resolve it. Because the service has no dependencies, the solution is as simple as instantiating Service, and Angular does this for us. However, we need to tell Angular about this construct for the DI machinery ...