Performance: Two-way binding in forms
MEDIUM IMPACT
Two-way binding in forms affects input responsiveness and rendering speed during user interactions.
<input [value]="user.name" (input)="user.name = $event.target.value" /> <input [value]="user.email" (input)="user.email = $event.target.value" />
<input [(ngModel)]="user.name" /> <input [(ngModel)]="user.email" /> <!-- Many inputs all using two-way binding -->
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Two-way binding on many inputs | High (many bindings) | Multiple per keystroke | High due to frequent updates | [X] Bad |
| One-way binding with event handlers | Lower (manual updates) | Single or fewer per keystroke | Lower paint cost | [OK] Good |