When building forms in Angular, two important classes you will use are FormControl and FormGroup. Both come from Angular’s Reactive Forms Module, and they help you manage form data, validation, and state more efficiently.
In this tutorial, you will learn the difference between FormControl and FormGroup with clear examples.
What is FormControl?
A FormControl represents a single form field.
Example of FormControl
form-control-example.component.ts
import { Component } from '@angular/core';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
@Component({
selector: 'form-control-example',
standalone: true,
imports: [ReactiveFormsModule],
templateUrl: './form-control-example.component.html'
})
export class FormControlExampleComponent {
nameControl = new FormControl('');
}
form-control-example.component.html
<h3>FormControl Example</h3>
<input [formControl]="nameControl" placeholder="Enter your name">
<p>Value: {{ nameControl.value }}</p>
What is FormGroup?
A FormGroup is a collection of multiple FormControls.
It is used to group related fields together — like name, email, password, etc.
Simple Example of FormGroup
form-group-example.component.ts
import { Component } from '@angular/core';
import { FormGroup, FormControl, ReactiveFormsModule } from '@angular/forms';
@Component({
selector: 'form-group-example',
standalone: true,
imports: [ReactiveFormsModule],
templateUrl: './form-group-example.component.html'
})
export class FormGroupExampleComponent {
userForm = new FormGroup({
name: new FormControl(''),
email: new FormControl(''),
});
}
form-group-example.component.html
<h3>FormGroup Example</h3>
<form [formGroup]="userForm">
<input formControlName="name" placeholder="Name">
<input formControlName="email" placeholder="Email">
</form>
<p>Form Value: {{ userForm.value | json }}</p>
Difference FormControl vs FormGroup
| Feature | FormControl | FormGroup |
|---|---|---|
| Meaning | Represents a single form field | Represents a group of multiple form fields |
| Usage | Single input elements | Full form sections |
| Validation | Added directly to the control | Can apply validation to the group or individual controls |
| Value | Returns a single value | Returns an object containing multiple values |
| Example | Name input | Name + Email + Password form |