DEV Community

Cover image for Create simple form with Angular
Jozsef
Jozsef

Posted on • Updated on

Create simple form with Angular

This article will introduce how to set a simple form in Angular with ReactiveFormsModule.

In order to use ReactiveFormsModule functionalities you need to import ReactiveFormsModule in your module.

Image description

FromGroup containes all the input field value and binds those into a single json object. These are key values pair, keys can be accessable from the template through FormGroup instance.
FromControl has two optional paramter, the first one the value of the control and the second is the validators.
FormArray can holds and array of FormControl, its very hand to use when dynamic froms are required in form.

form ts

In the template FormGroup and its properties (FormControl, FormArray) can be bindable though formGroup, formControlName, formArryName

form html

This simple demo project can be found under this repo!

Top comments (0)