From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Reactive forms with FormBuilder
From the course: Building Applications with Angular, ASP.NET Core, and Entity Framework Core
Reactive forms with FormBuilder
- [Instructor] There are several ways to achieve form validation with Angular2. The more traditional method of template validation involves putting your validation logic or parameters inside the template or the HTML itself. The other way is with Reactive forms, or Model-driven forms. This is where we create the model of what we expect out of the form, and the model itself will contain the validation rules. Let's begin by opening up our register.component.ts. Then below line 1, lets import { FormBuilder } from '@angular/forms'. Then let's create the new property in our class called form. That way we can bind that to our HTML form. So above the constructor, I'll create it and call it form. Then inside our constructor, let's inject FormBuilder. And I'll call it fb for FormBuilder. Then inside the constructor, let's create a FormBuilder group. So we'll start with this.form = fb.group. Inside here, we'll need to pass in an object that defines our form model. So let's start with email, and…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Set up Identity Framework13m 31s
-
(Locked)
Register from Angular4m 26s
-
(Locked)
Reactive forms with FormBuilder5m 49s
-
(Locked)
Save token in the browser3m 39s
-
(Locked)
Pass token with Angular requests5m 6s
-
(Locked)
Auth token middleware in ASP.NET7m 55s
-
(Locked)
Associate user with quiz and question5m 35s
-
(Locked)
Logging in6m 38s
-
(Locked)
Logging out3m 23s
-
(Locked)
-
-