Optional list of providers to be injected into the context of the Factory function.
Injection token
Optional enum defining lifetime of the provider that is returned by the Factory function.
Factory function that returns an instance of the provider to be injected.
Generated using TypeDoc
Interface defining a Factory type provider.
For example:
const connectionFactory = { provide: 'CONNECTION', useFactory: (optionsProvider: OptionsProvider) => { const options = optionsProvider.get(); return new DatabaseConnection(options); }, inject: [OptionsProvider], };
Use factory
Injection scopes