liveBook · Manning

ngModel

As explained in Modern Angular

ngModel is an Angular directive that synchronizes a form control's value with a component property through two-way binding.

ngModel is an Angular directive that keeps a form control and a component property synchronized through two-way binding. In a standalone component, import FormsModule through the component metadata before using it. section 2.3.1

Standalone login form

Bind the email and password inputs to credentials.email and credentials.password with [(ngModel)]. Add FormsModule to imports; the component can then update its credentials object as users enter values.

The pattern fits a practical login component: required-field feedback can inspect the synchronized credentials, while a submit handler can pass them to an authentication service.

How Modern Angular covers it

How deep it goes
Shows template bindings and the required FormsModule import, but does not explain directive internals or broader form architecture.
Examples
Uses email and password inputs in a standalone login component, with required-field feedback and authentication submission.
What it assumes
Assumes familiarity with Angular components and templates while demonstrating standalone imports and FormsModule usage.
What you can do after
Apply it via FormsModule to synchronize standalone login inputs with component state.
How it connects
Connects two-way binding with FormsModule, standalone components, NgModule interoperability, form controls, and validation checks.

Also explained in

Compare how 2 books explain ngModel →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Modern Angular. The section links point to the parts of the book it draws on.