tezvyn:

What bindings do v-model and ngModel sugar, and why?

Source: angular.devintermediate

TESTS: If you know two-way binding is property binding plus an event. OUTLINE: v-model sugars value and input; ngModel sugars [value] and (ngModelChange). This enforces one-way data flow for predictable state.

WHAT IT TESTS: Whether you understand that two-way binding is not native mutation sync but syntactic sugar for a property binding pushing data down and an event binding notifying changes up. ANSWER OUTLINE: In Vue, v-model expands to a value prop and an input or update event; in Angular, [(ngModel)] expands to [value] and (ngModelChange). This props-down, events-up pattern preserves unidirectional data flow, which makes component state predictable, eases debugging, and lets child components remain reusable and framework-agnostic.

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.

What bindings do v-model and ngModel sugar, and why? · Tezvyn