What I'm trying to achieve is having a component/directive input required only when another input is given, for example:
@Input() name!:string;
@Input({ required: name!!}) surname!:string;
Is this possible?
I tried to set required: name!! but it doesn't work as intended, the only fields I potentially have access to are static fields
This is not possible, you can refer to
thisin the decorators.Also keep in mind that
requiredinputs are a compiler only feature. This information doesn't make it into the runtime bundles.