liveBook · Manning

Two-way binding

Also called two-way data binding

Two-way binding is a data-binding relationship in which changes to either of two corresponding values automatically update the other.

How 3 Manning books explain it

Pro Angular 16

Two-way data binding is a technique that synchronizes changes between application data and its user-interface representation in both directions.

How it is used
Synchronizes form controls with component data so user edits update application state and application changes update the controls.
How deep it goes
Works through paired bindings, ngModel setup, a form, and a custom directive; limits the custom implementation to input elements.
Examples
Uses task checkboxes, synchronized product-name inputs, a product-entry form, and a custom input directive.
What you can do after
Build it from scratch with paired bindings or a custom directive, and apply it via ngModel to form controls.

Read how Pro Angular 16 explains two-way binding →

Web Component Development with Modern Libraries and Tooling

A data-binding relationship in which changes synchronize between a data value and its bound user-interface representation.

How it is used
Keeps component properties synchronized with inputs, attributes, or child components as values change.
How deep it goes
Explains binding through declarations and visible updates, without detailing binding-engine internals.
Examples
Uses an area calculator with sliders, a color radio group, and a greeting component sharing its color.
What you can do after
Apply it via wrec to synchronize inputs or child components, and configure Lit attribute reflection when needed.

Read how Web Component Development with Modern Libraries and Tooling explains two-way binding →

Build a Frontend Web Framework (From Scratch)

A synchronization technique in which changes to application state are reflected in the user interface and changes to the interface are reflected back in the state.

How it is used
Synchronizes form controls with application state in a component-based TODO interface.
How deep it goes
Defines the state-DOM flow and implements it with a value attribute, input listener, dispatched event, and reducer.
Examples
Uses a currentTodo text input and an editable TODO item to demonstrate state updates from typed values.
What you can do after
Build it from scratch by binding an input value to state and dispatching input events that update the state.

Read how Build a Frontend Web Framework (From Scratch) explains two-way binding →

Also covered in

What to know first

Related concepts

Questions about two-way binding

What is two-way binding?

Two-way binding is a data-binding relationship in which changes to either of two corresponding values automatically update the other.

Which Manning books explain two-way binding?

Pro Angular 16, Web Component Development with Modern Libraries and Tooling and Build a Frontend Web Framework (From Scratch).

What should I know before learning two-way binding?

Manning books that teach two-way binding usually introduce attribute and signal first.

What is the difference between two-way binding and unidirectional data flow?

Two-way binding is a data-binding relationship in which changes to either of two corresponding values automatically update the other. Unidirectional data flow is a pattern in which data, state changes, or updates propagate along defined paths in one direction, without automatic reverse propagation.

What is two-way binding also called?

Two-way binding is also called two-way data binding.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.