Using Two-Way Data Binding
Two-way data binding combines the input and output binding into a single notation using the ngModel
directive.
What this is doing behind the scenes is equivalent to:
To create your own component that supports two-way binding, you must define an @Output
property to match an @Input
, but suffix it with the Change
. The code example below, inside class CounterComponent shows how to make property count support two-way binding.
app/counter.component.ts
app/counter.component.html
Last updated