Skip to content
Related Articles

Related Articles

Angular forms FormControlName Directive

Improve Article
Save Article
  • Difficulty Level : Expert
  • Last Updated : 03 Jun, 2021
Improve Article
Save Article

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.


<form [FormControlName] ="name">

Exported from:

  • ReactiveFormsModule



  • [FormControlName]


  • Create the Angular app to be used
  • In app.component.ts make an object that contain value for the input.
  • In app.component.html use FormControlName 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(),
        rollno: new FormControl() 
    get name(): any {
      return this.form.get('name');
    get rollno(): any {
      return this.form.get('rollno');
    onSubmit(): void {


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



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!