In Chapter 8, Template and Data Binding Syntax, we learned how to leverage Data Binding and templating in Angular. Here, we'll combine these new notions with forms. Anyone with two hours, of HTML experience knows what <form> means and how to use them. With a couple of hours of HTML behind you, you know how to identify the different information in your forms and choose a method (that is GET, POST, PUT, and DELETE) to send everything to the backend of your choice.
In this recipe, however, we will build forms using imperative TypeScript code instead of good old HTML. Why, you ask? Well, this allows us to test our forms without relying on end-to-end tests that need the DOM to be generated. With reactive forms, we can test our form with classical unit tests as described in Chapter 16, Testing Angular Apps Using Jasmine and Protractor Frameworks.
Let...