Search code examples
angularangular2-formsangular4-forms

How to disable form formGroup?


I need to use something like this:

<form [formGroup]="" [disabled]="func(formGroup, cond)">

And disable this:

    funct(form, cond) {

      if (cond) {
          form.disable();
       }

     }

Solution

  • like suggested by @JB Nizet the disabled expects only a boolean value (true or false). Upgrade your code with a variable 'cond' and if this is true you disable the form.