Angular forms FormGroupName Directive Last Updated : 06 Jan, 2023 Comments Improve Suggest changes Like Article Like Report In this article, we are going to see what is FormGroupName in Angular 10 and how to use it. The FormGroupName is used to sync a nested FormGroup to a DOM element. Syntax: <form [FormGroupName] ="details"> Exported from: ReactiveFormsModule Selectors: [FormGroupName] Approach: Create the Angular app to be usedIn app.component.ts make an object that contain value for the input.In app.component.html use FormGroupName to get values.Serve the angular app using ng serve to see the output. Example: app.component.ts import { Component, Inject } from '@angular/core'; import { FormGroup, FormControl, FormArray } from '@angular/forms' @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class AppComponent { form = new FormGroup({ details: new FormGroup({ name: new FormControl(), email: new FormControl() }) }); get name(): any { return this.form.get('details.name'); } get email(): any { return this.form.get('details.email'); } onSubmit(): void { console.log(this.form.value); } } app.module.ts import { NgModule } from '@angular/core'; // Importing forms module import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { AppComponent } from './app.component'; @NgModule({ bootstrap: [ AppComponent ], declarations: [ AppComponent ], imports: [ FormsModule, BrowserModule, BrowserAnimationsModule, ReactiveFormsModule ] }) export class AppModule { } app.component.html <br> <form [formGroup]="form" (ngSubmit)="onSubmit()"> <div formGroupName="details"> <input formControlName="name" placeholder="Name"> <input formControlName="email" placeholder="Email"> </div> <br> <button type='submit'>Submit</button> <br><br> </form> Output: Reference: https://angular.io/api/forms/FormGroupName Comment More infoAdvertise with us Next Article Angular forms FormGroupName Directive taran910 Follow Improve Article Tags : Web Technologies AngularJS AngularJS-Directives Angular10 Similar Reads Angular forms FormControlName Directive In this article, we are going to see what is FormControlName in Angular 10 and how to use it. FormControlName is used to sync a FormControl in an existing FormGroup to a form control element by name. Syntax: <form [FormControlName] ="name"> Exported from: ReactiveFormsModule  Selectors: [Form 1 min read Angular forms FormArrayName Directive In this article, we are going to see what is Style in Angular 10 and how to use it. The FormArrayName is used to sync a nested FormArray to a DOM element. Syntax: <div formArrayName="arrayName"> NgModule: Module used by FormArrayName is: ReactiveFormsModule  Selectors: [FormArrayName] Approac 1 min read Angular forms NgForm Directive In this article, we are going to see what is NgForm in Angular 10 and how to use it. NgForm is used to create a top-level form group Instance, and it binds the form to the given form value. Syntax: <form #FormName = "ngForm"> </form> NgModule: Module used by NgForm is: FormsModule Select 1 min read Angular FormsModule Directive In this article, we are going to see what is FormsModule in Angular 10 and how to use it. The FormsModule is used to make all the necessary imports for form implementation. Syntax: import { FormsModule } from '@angular/forms'; Approach: Create an Angular app to be used.In app.component.ts import fo 1 min read Angular forms NgModelGroup Directive In this article, we are going to see what is NgModelGroup in Angular 10 and how to use it. The NgModelGroup is used to create a top-level form group Instance, and it binds the form to the given form value. Syntax: <div ngModelGroup="name"></div> NgModule: Module used by NgModelGroup is: 1 min read Like