# Binding and Events in Angular

Binding and Events in Angular: Property Binding, Event Binding, Two-Way Binding, @if and @for.

Updated: November 14, 2026

1. [Property Binding](https://www.ask-codey.com/lessons/binding-and-events-in-angular-property-binding) (Apprentice): Square brackets bind an element's property to the component's data, such as \[src\]="imageUrl" or \[disabled\]="soldOut". \[class.name\] turns a CSS class on and off, and \[style.prop\] sets one style, all kept up to date by Angular.
2. [Event Binding](https://www.ask-codey.com/lessons/binding-and-events-in-angular-event-binding) (Apprentice): Parentheses bind an event to a method of the component, such as (click)="addToCart()". $event passes the event itself, a template reference variable such as #box passes an element, and (keyup.enter) listens for one key.
3. [Two-Way Binding](https://www.ask-codey.com/lessons/binding-and-events-in-angular-two-way-binding) (Apprentice): \[(ngModel)\] binds a form field both ways: the field shows the signal's value, and typing in the field changes the signal. Import FormsModule to use it. Brackets in and parentheses out, together: the banana in a box.
4. [@if and @for](https://www.ask-codey.com/lessons/binding-and-events-in-angular-if-and-for) (Apprentice): @if shows part of a template only when a condition is true, with @else for the other case. @for repeats part of a template for each item of a list, with track to tell the items apart, and @empty for an empty list.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/binding-and-events-in-angular
