Is it possible to access specific formgroup value onsubmit

Viewed 25

Inside one component,

there are 2 form groups.

Both form has a submit type input and few form controls.

like below . Form group A and B.

<form [formGroup]...>
  <input formControlName.../><button type="submit" .../>
</form>
<form [formGroup]...>
  <input formControlName.../><button type="submit" .../>
</form>

My question is, how can I access a particular form group value from these two form control, in 1 onSubmit() function ?

1 Answers

Try and use this syntax:

<form (ngSubmit)="onSubmit(formGroup.value)">
</form>
Related