Inject

Inject decorator

What it does

A parameter decorator that specifies a dependency.

How to use

@Injectable() class Car { constructor(@Inject("MyEngine") public engine:Engine) {} }

Description

For more details, see the Dependency Injection Guide.

Example

class Engine {}

@Injectable()
class Car {
  constructor(@Inject('MyEngine') public engine: Engine) {}
}

const injector =
    ReflectiveInjector.resolveAndCreate([{provide: 'MyEngine', useCla