Skip to main content

Installation

Install Form Nodes alongside Angular 21.0.7+ or 22.1.5+:

npm install --save @ngblocks/form-nodes

💡 Requirements​

  • Angular ^21.0.7 || ^22.1.5
  • TypeScript 5.9 for Angular 21, or TypeScript 6.0 for Angular 22
  • Signals, which are provided by @angular/core

Keep @angular/common, @angular/core, and @angular/forms on matching Angular versions. They are peer dependencies of Form Nodes; @angular/common supplies custom error-template rendering.

See the complete compatibility table before upgrading Angular or Form Nodes. The Form Nodes version does not mirror the Angular version.

Choose your imports​

Import the primitives and validators used by your model:

import { field, form, required } from '@ngblocks/form-nodes';

For Angular templates and custom controls, add the integration you need:

TaskImport from @ngblocks/form-nodesWhere it goes
Bind a control or native form with [formNode]FormNodeDirectiveThe component's imports array
Render <form-node-errors>FormNodeErrorsThe component's imports array
Observe form state inside a custom controluseFormNodeStateCall in the control's class initializer

The first-form example shows the model, component imports, and template together. If Angular does not recognize a binding, check the directive import troubleshooting section.

The package is distributed as side-effect-free ESM. Consumer bundlers can remove validators and other exports that are not imported. The published package includes TypeScript declarations, source maps, the MIT license, a changelog, and a consumer AGENTS.md guide. See Coding agents to connect the guide to your application instructions.

Forms work outside Angular DI

Creating and using field() and form() does not require an Angular injection context. Angular dependency injection is used only when an optional integration explicitly needs it.

🔗 Next step​

Continue with Your first form.