tezvyn:

Angular Two-Way Binding: [(ngModel)]

Source: angular.devintermediate

Think of [(ngModel)] as a walkie-talkie for data, syncing a component property with a template view. It's used in forms where user input immediately updates a variable, and vice-versa. The footgun is overusing it, which creates tangled data flows.

Think of [(ngModel)] as a two-way street for data, automatically syncing a component property with a template element like an input field. It's syntactic sugar for combining property binding `[ngModel]` and event binding `(ngModelChange)`. This is the go-to for simple forms where user input and component data must always match. The footgun is its convenience; overusing it outside of simple forms obscures data flow, making it hard to trace where state changes originate.

Read the original → angular.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Angular Two-Way Binding: [(ngModel)] · Tezvyn