# Property binding Property binding in Angular helps you set values for properties of HTML elements or directives. Use property binding to do things such as toggle button features, set paths programmatically, and share values between components.
See the for a working example containing the code snippets in this guide.
## Prerequisites * [Basics of components](guide/architecture-components) * [Basics of templates](guide/glossary#template) * [Binding syntax](guide/binding-syntax) ## Understanding the flow of data Property binding moves a value in one direction, from a component's property into a target element property. To read a target element property or call one of its methods, see the API reference for [ViewChild](api/core/ViewChild) and [ContentChild](api/core/ContentChild). ## Binding to a property
For information on listening for events, see [Event binding](guide/event-binding).
To bind to an element's property, enclose it in square brackets, `[]`, which identifies the property as a target property. A target property is the DOM property to which you want to assign a value. To assign a value to a target property for the image element's `src` property, type the following code: In most cases, the target name is the name of a property, even when it appears to be the name of an attribute. In this example, `src` is the name of the `` element property. The brackets, `[]`, cause Angular to evaluate the right-hand side of the assignment as a dynamic expression. Without the brackets, Angular treats the right-hand side as a string literal and sets the property to that static value. To assign a string to a component's property (such as the `childItem` of the `ItemDetailComponent`), you use the same bracket assignment notation: ## Setting an element property to a component property value To bind the `src` property of an `` element to a component's property, place `src` in square brackets followed by an equal sign and then the property. Using the property `itemImageUrl`, type the following code: Declare the `itemImageUrl` property in the class, in this case `AppComponent`. {@a colspan} #### `colspan` and `colSpan` A common point of confusion is between the attribute, `colspan`, and the property, `colSpan`. Notice that these two names differ by only a single letter. To use property binding using `colSpan`, type the following: To disable a button while the component's `isUnchanged` property is `true`, type the following: To set a property of a directive, type the following: To set the model property of a custom component for parent and child components to communicate with each other, type the following: ## Toggling button features To use a Boolean value to disable a button's features, bind the `disabled` DOM attribute to a Boolean property in the class. Because the value of the property `isUnchanged` is `true` in the `AppComponent`, Angular disables the button. ## What's next * [Property binding best practices](guide/property-binding-best-practices) * [Event binding](guide/event-binding) * [Text Interpolation](guide/interpolation) * [Class & Style Binding](guide/class-binding) * [Attribute Binding](guide/attribute-binding) @reviewed 2023-09-01