ngModel

noun

say it: “EN-JEE MOD-ul” /ˌɛn ˈdʒiː ˈmɒdəl/

An Angular directive that ties a form field to a component value both ways.

What is ngModel in Angular?

ngModel — A directive from FormsModule that ties a form field to a component value both ways: typing changes the value, and changing the value updates the field. It's written [(ngModel)].

<input type="number" [(ngModel)]="quantity">
<p>{{ quantity }} in the cart</p>

In a sentence

  • “With ngModel on the quantity box, the box and the count always match.”

Level: Apprentice · More Angular terms at this level

Updated