1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

Angular How to make [formControl] an optional field

Discussão em 'Angular' iniciado por HsuanWei Fu, Setembro 27, 2024 às 15:33.

  1. HsuanWei Fu

    HsuanWei Fu Guest

    In Angular you can add attributes to inputs and make them optional using attr:

    <input [type]="text" [attr.id]="id">


    But how do you make a form control optional? I want something like this:

    <input [type]="text" [attr.formControl]="someControl">


    Where the formControl will not be set if someControl is undefined or null?

    Continue reading...

Compartilhe esta Página