Pattern to enable customization through DI
问题 I'm looking at the implementation of in-memory-web-api and there is the following code: @Injectable() export class InMemoryBackendService { protected config: InMemoryBackendConfigArgs = new InMemoryBackendConfig(); ^^^^^^ ... constructor( @Inject(InMemoryBackendConfig) @Optional() config: InMemoryBackendConfigArgs ^^^^^^ ) { ... As I understand the pattern is the following: Defined class property and instantiate a dependency without using DI Optionally inject dependency If a user provides