13 Using events and forms

 

This chapter covers

  • Using bindings to respond to events
  • Using template references
  • Using two-way bindings to synchronize component properties and HTML elements
  • Validating form data and displaying validation error messages

In this chapter, I continue describing the basic Angular functionality, focusing on features that respond to user interaction. I explain how to create event bindings and how to use two-way bindings to manage the flow of data between the model and the template. One of the main forms of user interaction in a web application is the use of HTML forms, and I explain how event bindings and two-way data bindings are used to support them and validate the content that the user provides. Table 13.1 puts events and forms in context.

13.1 Preparing the example project

13.2 Using the event binding

13.2.1 Using event data

13.2.2 Handling events in the component

13.2.3 Using template reference variables

13.3 Using two-way data bindings

13.3.1 Using the ngModel directive

13.4 Working with forms

13.4.1 Adding a form to the example application

13.4.2 Adding form data validation

13.4.3 Validating the entire form

13.4.4 Completing the form

13.5 Summary