Angular 18 : Conditional required input

Discussão em 'Angular' iniciado por miguel gremy, Janeiro 2, 2025.

  1. miguel gremy

    miguel gremy Guest

    Is there a way to require an input based on another value ? I need to add an input which is required only if another input is not filled (and vice versa) using the model API (not the @Input decorator).

    We added this behavior by adding a condition in ngOnInit and by throwing an error if the two inputs are undefined, but I'm looking for a "better" and "clean" way to implement it. If angular has a built-in functionality for this kind of setup ?

    Thanks for your help !

    Continue reading...

Compartilhe esta Página