Skip to content
Related Articles
Open in App
Not now

Related Articles

How to get the value of the form in Angular ?

Improve Article
Save Article
  • Last Updated : 24 May, 2021
Improve Article
Save Article

In this article, we are going to see how to get value from the form in Angular 10. We will use AbstractControl value property to get the form value in an object.



Return Value:

  • object: It is an object containing form value


  • Create the Angular app to be used
  • In app.component.html make a form using ngForm directive.
  • Now get the value using AbstractControl value property
  • Serve the angular app using ng serve to see the output.

Example 1:


import { NgModule } from '@angular/core';
// Importing forms module
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { AppComponent }   from './app.component';
  bootstrap: [
  declarations: [
  imports: [
export class AppModule { }


<form #gfg = "ngForm">
    Name: <input type="text" name = 'name' ngModel>
    Date: <input type="date" name = 'date' ngModel>
{{ gfg.value | json }}



My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!