Adding Specialty Pizzas using patchValue

We have a relatively functional (if plain) order form. Time to zest that up with some specials using "patchValue" in reactive forms.

In our case, the specials will be pre-configured collections of toppings (nothing too crazy). This also lets the user customize the specials (maybe you’re not a fan of hot sauce but love everything else about buffalo chicken).

patchValue in reactive form

The traditional form story doesn’t provide much comfort here, but through patchValue, reactive forms make this easy.

First, let’s set up two specials for today:Hawaiian and Buffalo Chicken.

We’ll add the following code as a property declaration on the component class:

Create a free account to view this lesson.

By signing up, you agree to Educative's Terms of Service and Privacy Policy