VOOZH about

URL: https://www.geeksforgeeks.org/angular-js/angular-forms-ngform-directive/

⇱ Angular forms NgForm Directive - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Angular forms NgForm Directive

Last Updated : 23 Jul, 2025

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

Selectors:

  • [ngForm]

Approach: 

  • Create the Angular app to be used
  • In app.module.ts import FormsModule.
  • In app.component.html make a form and store its value in ngForm variable and show its value in a JSON form.
  • Serve the angular app using ng serve to see the output.

Example 1:

Output:

👁 Image

Reference: https://v17.angular.io/api/forms/NgForm

Comment

Explore