Home > database >  disabling the button for this particular form
disabling the button for this particular form

Time:11-16

How to disable the button for a single group in a form? Currently when I dirty the control both buttons (save and hidden) become active. Using

[disabled]="!cappingForm.dirty"

doesn't work because when I dirty one control all the buttons are unlocked, while there should be one. How to refer to the specific form I am using? https://stackblitz.com/edit/angular-qd7vym?fbclid=IwAR29etqG_Zm3wZ9X6E70hRJBeIpskbLh1B0_GpYwD8cy-T8bM0xeWwt0GH0&file=src/app/app.component.ts,src/app/app.component.html,src/app/app.module.ts

CodePudding user response:

You can specific formGroup that you need by using this.cappingForm.get(template.name)

modify the condition to

[disabled]="!this.cappingForm.get(template.name).dirty"

Full example: Stackblitz

  • Related