Angular: getting started

Lesson 05 · 11 min

An input and ngModel

Two-way binding: you type and the class field changes. Needs FormsModule.

11 minLesson 5 of 8Practice includedAsk AI on any point

[(ngModel)]="title" writes into the class's title and reads it back. Without FormsModule in the component's imports there's no directive — the compiler will tell you so. For a simple start that's enough. Reactive forms (FormControl) are for many fields and validation; don't mix both styles on one screen without a reason.

Sign in to continue

The rest of this lesson opens after sign up

The first lesson of every course is open without an account. To read on, solve the practice and use Ask, create a free account or log in.