79693096

Date: 2025-07-07 15:37:53
Score: 1.5
Natty:
Report link

With DI using the inject function this is quite straightforward:

export class MyComponent {
  config = inject(FOO, { optional: true }) ?? true;
}

Note, Thx: Json-derulo for his [answer on GitHub](https://github.com/angular/angular/issues/25395#issuecomment-2320964696)

Reasons:
  • Blacklisted phrase (1): Thx
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • High reputation (-1):
Posted by: Raphaƫl Balet