11 Using Data Bindings

 

This chapter covers

  • Understanding how to apply a data binding
  • Using data bindings to set HTML element attributes
  • Using data bindings to assign elements to classes
  • Using data bindings to set element style properties
  • Using the string interpolation binding

The previous chapter used some simple data bindings to explain how Angular detects changes and updates HTML content. In this chapter, I describe the basic data bindings that Angular provides in-depth and demonstrate how they can be used to produce dynamic content. In later chapters, I describe more advanced data bindings and explain how to extend the Angular binding system with custom features. Table 11.1 puts data bindings in context.

11.1 Preparing for this chapter

11.2 Understanding one-way data bindings

11.2.1 Understanding the binding target

11.2.2 Understanding the expression

11.2.3 Understanding the brackets

11.2.4 Understanding the host element

11.3 Using the standard property and attribute bindings

11.3.1 Using the standard property binding

11.3.2 Using the string interpolation binding

11.3.3 Using the attribute binding

11.4 Setting classes and styles

11.4.1 Using the class bindings

11.4.2 Using the style bindings

11.5 Summary