Building our first Reactive Form
In this section, we'll create our first Reactive Form. More specifically, we're going to build a CityEditComponent that will give our users the chance to edit an existing city record.
To do that, we'll do the following:
- Add a reference to the
ReactiveFormsModuleto ourAppModuleclass. - Create the
CityEditComponentTypeScript and template files.
Let's get started.
ReactiveFormsModule
The first thing we have to do to start working with Reactive Forms is add a reference to the ReactiveFormsModule in the AppModule class.
From Solution Explorer, open the /ClientApp/src/app/app.module.ts file and add the following code (the updated source code is highlighted):
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientModule, HTTP_INTERCEPTORS } from &apos...