Skip to content

Forms in Standalone Components

Angular standalone components can use forms without NgModules.

import { Component } from "@angular/core";
import { ReactiveFormsModule, FormControl } from "@angular/forms";
@Component({
selector: "app-login",
standalone: true,
imports: [ReactiveFormsModule],
template: ` <input [formControl]="email" /> `,
})
export class LoginComponent {
email = new FormControl("");
}