1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Angular How to make [formControl] an optional field

Discussão em 'Angular' iniciado por HsuanWei Fu, Setembro 27, 2024.

  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