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)