Skip to content
Related Articles
Open in App
Not now

Related Articles

Angular forms FormGroupDirective

Improve Article
Save Article
  • Last Updated : 02 Jun, 2021
Improve Article
Save Article

In this article, we are going to see what is FormGroupDirective in Angular 10 and how to use it.

FormGroupDirective is used to Bind an existing FormGroup to a DOM element.


<form [FormGroup] ="name">

Exported from:

  • ReactiveFormsModule



  • [FormGroup]


  • Create the Angular app to be used
  • In app.component.ts make an object that contains a value for the input.
  • In app.component.html use FormGroup to get values.
  • Serve the angular app using ng serve to see the output.

Example 1:


import { Component, Inject } from '@angular/core';
  import { FormGroup, FormControl, FormArray } from '@angular/forms'
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls: [ './app.component.css' ]
  export class AppComponent  {
    form = new FormGroup({
      name: new FormControl()
    get name(): any {
      return this.form.get('name');
    onSubmit(): void {


<form [formGroup]="form" (ngSubmit)="onSubmit()">
  <input formControlName="name" placeholder="Name">
  <button type='submit'>Submit</button>



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!