...

/

Solution: Implement Reactive Form

Solution: Implement Reactive Form

Execute a possible solution for the exercise presented in the previous lesson.

We'll cover the following...

Let’s break the solution down and describe its most essential parts.

Component class

We define the RegistrationForm interface with two string form controls to leverage the full potential of typed forms.

interface RegistrationForm {
    username: FormControl<string>;
    email: FormControl<string>;
}

Remember: Usually, it’s good practice to have model objects in a standalone file, but for the sake of the conciseness of the demo, we placed it inside the component class.

We use the interface as the type for our form, which provides all the benefits of typed forms, and we set an empty ...