Generated banner for Angular Developer
Generated logo for Angular Developer

Angular Developer

Angular (Google)OfficialCreated by Google LLCDistributed by Angular (Google)

  • Skill
  • Tool integration
  • Software development
  • MIT
  • No issues found

From the author

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), queries and content projection, forms, dependency injection, routing, server and hybrid rendering (SSR, prerendering, hydration), accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, naming conventions, or CLI tooling.
— the description by Google LLC

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

The Angular Developer skill assists in building and maintaining Angular applications. It provides structured guidance on project scaffolding, component architecture, state management with signals, HTTP communication, and accessibility. It emphasizes the use of the Angular CLI for consistency and mandates build verification to ensure code quality. The skill covers modern Angular features including signal-based reactivity, deferrable views, and headless accessibility components via Angular Aria.

What it does

  • Generates boilerplate code for components, services, and routes using the Angular CLI.
  • Provides architectural advice on state management using signals, linked signals, and resources.
  • Offers guidance on implementing accessible UI patterns using Angular Aria directives.
  • Advises on modern rendering strategies including SSR, prerendering, and hydration.
  • Ensures code quality by requiring build verification after generation.
  • Recommends modern naming conventions and styling approaches like Tailwind CSS.

When to use it

  • When scaffolding a new Angular project or adding new features to an existing one.
  • When needing to implement complex state management or asynchronous data fetching.
  • When building accessible custom components like accordions, listboxes, or comboboxes.
  • When refactoring older code to modern Angular standards or migrating to newer versions.
  • When troubleshooting build errors or optimizing component performance.

Advantages

  • Promotes consistency by enforcing Angular CLI usage and standard naming conventions.
  • Reduces technical debt by prioritizing modern signal-based reactivity and form management.
  • Improves accessibility by integrating headless ARIA patterns.
  • Ensures functional reliability through mandatory build verification steps.
  • Provides context-aware guidance based on the specific Angular version of the project.

Usage examples

“Create a new Angular component for a user profile with signal-based inputs.”
The agent generates the component structure using the Angular CLI, implementing signal-based inputs as per the latest framework standards.
“How do I implement an accessible accordion in my Angular application?”
The agent provides the necessary imports from the Angular Aria package and demonstrates the correct HTML structure using the required directives.
“Help me refactor my legacy animation code to the modern approach.”
The agent analyzes the project version and provides a guide on transitioning to native CSS animations using the recommended enter and leave classes.
“What is the best way to fetch data in a component using signals?”
The agent explains the use of the resource API for asynchronous data fetching and provides a code example for integrating it into the component.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/angular/angular-developer/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip angular-developer.zip -d .agents/skills

Documentation by Google LLC

Angular Developer Guidelines

  1. Always analyze the project's Angular version before providing guidance, as best practices and available features can vary significantly between versions. If creating a new project with Angular CLI, do not specify a version unless prompted by the user.

  2. When generating code, follow Angular's style guide and best practices for maintainability and performance. Use the Angular CLI for scaffolding components, services, directives, pipes, and routes to ensure consistency.

  3. Once you finish generating code, run ng build to ensure there are no build errors. If there are errors, analyze the error messages and fix them before proceeding. Do not skip this step, as it is critical for ensuring the generated code is correct and functional.

Creating New Projects

If no guidelines are provided by the user, here are some default rules to follow when creating a new Angular project:

  1. Use the latest stable version of Angular unless the user specifies otherwise.

  2. Use Signal Forms for form management in new projects (stable in Angular v22 and newer) Find out more.

Execution Rules for ng new: When asked to create a new Angular project, you must determine the correct execution command by following these strict steps:

Step 1: Check for an explicit user version.

  • IF the user requests a specific version (e.g., Angular 15), bypass local installations and strictly use npx.

  • Command: npx @angular/cli@<requested_version> new <project-name>

Step 2: Check for an existing Angular installation.

  • IF no specific version is requested, run ng version in the terminal to check if the Angular CLI is already installed on the system.

  • IF the command succeeds and returns an installed version, use the local/global installation directly.

  • Command: ng new <project-name>

Step 3: Fallback to Latest.

  • IF no specific version is requested AND the ng version command fails (indicating no Angular installation exists), you must use npx to fetch the latest version.

  • Command: npx @angular/cli@latest new <project-name>

Components

When working with Angular components, consult the following references based on the task:

  • Fundamentals: Anatomy, metadata, core concepts, self-closing tags, and template control flow (@if, @for, @switch). Read components.md

  • Inputs: Signal-based inputs, transforms, and model inputs. Read inputs.md

  • Outputs: Signal-based outputs and custom event best practices. Read outputs.md

  • Host Elements: Host bindings and attribute injection. Read host-elements.md

  • Naming Conventions: Modern Angular v20+ naming style ("Intent over Role") for files, components, services, directives, pipes, and models. Read naming-conventions.md

  • Queries and Content Projection: Signal-based view and content queries (viewChild, viewChildren, contentChild, contentChildren) and content projection with <ng-content> slots and fallback content. Read queries-and-projection.md

  • Deferrable Views: Lazy loading, code splitting, triggers, prefetching, loading states, SSR, and layout stability with @defer. Read deferrable-views.md

If you require deeper documentation not found in the references above, read the documentation at https://angular.dev/guide/components.

Reactivity and Data Management

When managing state and data reactivity, use Angular Signals and consult the following references:

  • Signals Overview: Core signal concepts (signal, computed), reactive contexts, and untracked. Read signals-overview.md

  • Dependent State (linkedSignal): Creating writable state linked to source signals. Read linked-signal.md

  • Async Reactivity (resource): Fetching asynchronous data directly into signal state. Read resource.md

  • Side Effects (effect): Logging, third-party DOM manipulation (afterRenderEffect), and when NOT to use effects. Read effects.md

HTTP Communication

When communicating with backend services, use Angular HTTP APIs and consult the following reference:

  • HTTP Client and Resources: provideHttpClient, HttpClient, interceptors, and httpResource. Read http-client.md

Forms

In most cases for new apps, prefer signal forms. When making a forms decision, analyze the project and consider the following guidelines:

  • If the application is using v22 or newer and this is a new form, prefer Signal Forms.

  • For older applications or when working with existing forms, use the appropriate form type that matches the applications current form strategy.

  • Signal Forms: Use signals for form state management. Read signal-forms.md

  • Template-driven forms: Use for simple forms. Read template-driven-forms.md

  • Reactive forms: Use for complex forms. Read reactive-forms.md

Dependency Injection

When implementing dependency injection in Angular, follow these guidelines:

  • Fundamentals: Overview of Dependency Injection, services, and the inject() function. Read di-fundamentals.md

  • Creating and Using Services: Creating services, the providedIn: 'root' option, and injecting into components or other services. Read creating-services.md

  • Defining Dependency Providers: Automatic vs manual provision, InjectionToken, useClass, useValue, useFactory, and scopes. Read defining-providers.md

  • Injection Context: Where inject() is allowed, runInInjectionContext, and assertInInjectionContext. Read injection-context.md

  • Hierarchical Injectors: The EnvironmentInjector vs ElementInjector, resolution rules, modifiers (optional, skipSelf), and providers vs viewProviders. Read hierarchical-injectors.md

Pipes

When formatting values in templates, creating custom pipes, or reusing pipe-like logic in TypeScript, consult the following reference. Prefer pipes in templates; outside templates, avoid injecting pipe classes just to call transform().

  • Pipes: Built-in pipe imports, custom pipe naming and implementation, pure vs impure pipes, and TypeScript reuse patterns using standalone formatting functions or extracted plain functions. Read pipes.md

Angular Aria

When building accessible custom components for any of the following patterns: Accordion, Listbox, Combobox, Menu, Tabs, Toolbar, Tree, Grid, consult the following reference:

  • Angular Aria Components: Building headless, accessible components (Accordion, Listbox, Combobox, Menu, Tabs, Toolbar, Tree, Grid) and styling ARIA attributes. Read angular-aria.md

Routing

When implementing navigation in Angular, consult the following references:

  • Define Routes: URL paths, static vs dynamic segments, wildcards, and redirects. Read define-routes.md

  • Route Loading Strategies: Eager vs lazy loading, and context-aware loading. Read loading-strategies.md

  • Show Routes with Outlets: Using <router-outlet>, nested outlets, and named outlets. Read show-routes-with-outlets.md

  • Navigate to Routes: Declarative navigation with RouterLink and programmatic navigation with Router. Read navigate-to-routes.md

  • Control Route Access with Guards: Implementing CanActivate, CanMatch, and other guards for security. Read route-guards.md

  • Data Resolvers: Pre-fetching data before route activation with ResolveFn. Read data-resolvers.md

  • Router Lifecycle and Events: Chronological order of navigation events and debugging. Read router-lifecycle.md

  • Rendering Strategies: Choosing between CSR, SSG (prerendering), and SSR. Read rendering-strategies.md

  • Server and Hybrid Rendering: Implementing server routes, prerendering, hydration, server-compatible code, and request data in an SSR-configured app. Read server-side-rendering.md

  • Route Transition Animations: Enabling and customizing the View Transitions API. Read route-animations.md

If you require deeper documentation or more context, visit the official Angular Routing guide.

Styling and Animations

When implementing styling and animations in Angular, consult the following references:

  • Using Tailwind CSS with Angular: Integrating Tailwind CSS into Angular projects. Read tailwind-css.md

  • Angular Animations: Using native CSS (recommended) or the legacy DSL for dynamic effects. Read angular-animations.md

  • Styling components: Best practices for component styles and encapsulation. Read component-styling.md

Testing

When writing or updating tests, consult the following references based on the task:

  • Fundamentals: Best practices for unit testing (Vitest), async patterns, and TestBed. Read testing-fundamentals.md

  • Component Harnesses: Standard patterns for robust component interaction. Read component-harnesses.md

  • Router Testing: Using RouterTestingHarness for reliable navigation tests. Read router-testing.md

  • End-to-End (E2E) Testing: Setting up and running E2E tests. Read e2e-testing.md

Tooling

When working with Angular tooling, consult the following references:

  • Angular CLI: Creating applications, generating code (components, routes, services), serving, and building. Read cli.md

  • Code Modernization: Automatically refactoring to modern standards using migrations. Read migrations.md

  • Angular MCP Server: Available tools, configuration, and experimental features. Read mcp.md

  • Environment Configuration: Strategies for build-time and runtime configuration. Read environment-configuration.md

Files

references/signal-forms.md

Signal Forms

Signal Forms are the recommended approach for handling forms in modern Angular applications (v21+). They provide a reactive, type-safe, and model-driven way to manage form state using Angular Signals.

CRITICAL: You MUST use Angular's new Signal Forms API for all form-related functionality. Do NOT use null as a value or type of any fields.

Imports

You can import the following from @angular/forms/signals:

import {
  form,
  FormField,
  submit,
  // Rules for field state
  disabled,
  hidden,
  readonly,
  debounce,
  // Schema helpers
  applyWhen,
  applyEach,
  schema,
  // Custom validation
  validate,
  validateHttp,
  validateStandardSchema,
  // Metadata
  metadata,
} from '@angular/forms/signals';

Creating a Form

Use the form() function with a Signal model. The structure of the form is derived directly from the model.

import {Component, signal} from '@angular/core';
import {form, FormField} from '@angular/forms/signals';

@Component({
  // ...
  imports: [FormField],
})
export class Example {
  // 1. Define your model with initial values (avoid undefined)
  protected readonly userModel = signal({
    name: '', // CRITICAL: NEVER use null or undefined as initial values
    email: '',
    age: 0, // Use 0 for numbers, NOT null
    address: {
      street: '',
      city: '',
    },
    hobbies: [] as string[], // Use [] for arrays, NOT null
  });

  // WRONG - DO NOT DO THIS:
  // badModel = signal({
  //   name: null,      // ERROR: use '' instead
  //   age: null,       // ERROR: use 0 instead
  //   items: null      // ERROR: use [] instead
  // });

  // 2. Create the form
  protected readonly userForm = form(this.userModel);
}

Validation

Import validators from @angular/forms/signals.

import {required, email, min, max, minLength, maxLength, pattern} from '@angular/forms/signals';

Use them in the schema function passed to form():

userForm = form(this.userModel, (schemaPath) => {
  // Required
  required(schemaPath.name, {message: 'Name is required'});

  // Conditional required.
  required(schemaPath.name, {
    when({valueOf}) {
      return valueOf(schemaPath.age) > 10;
    },
  });

  // Email
  email(schemaPath.email, {message: 'Invalid email'});

  // Min/Max for numbers
  min(schemaPath.age, 18);
  max(schemaPath.age, 100);

  // MinLength/MaxLength for strings/arrays
  minLength(schemaPath.password, 8);
  maxLength(schemaPath.description, 500);

  // Pattern (Regex), applied only when the condition holds
  pattern(schemaPath.zipCode, /^\d{5}$/, {
    when({valueOf}) {
      return valueOf(schemaPath.country) === 'US';
    },
  });
});

FieldState vs FormField: The Parental Requirement

It's important to understand the difference between FormField (the structure) and FieldState (the actual data/signals).

RULE: You must CALL a field as a function to access its state signals (valid, touched, dirty, hidden, etc.).

// f is a FormField (structural)
const f = form(signal({cat: {name: 'pirojok-the-cat', age: 5}}));

f.cat.name; // FormField: You can't get flags from here!
f.cat.name.touched(); // ERROR: touched() does not exist on FormField

f.cat.name(); // FieldState: Calling it gives you access to signals
f.cat.name().touched(); // VALID: Accessing the signal
f.cat().name.touched(); // ERROR: f.cat() is state, it doesn't have children!

Similarly in a template:

<!-- WRONG: Property 'hidden' does not exist on type 'FormField' -->
@if (bookingForm.hotelDetails.hidden()) { ... }

<!-- RIGHT: Call it first -->
@if (bookingForm.hotelDetails().hidden()) { ... }

Disabled / Readonly / Hidden

Control field status using rules in the schema.

import {disabled, readonly, hidden} from '@angular/forms/signals';

userForm = form(this.userModel, (schemaPath) => {
  // Conditionally disabled
  disabled(schemaPath.password, {when: ({valueOf}) => !valueOf(schemaPath.createAccount)});

  // Conditionally hidden (does NOT remove from model, just marks as hidden)
  hidden(schemaPath.shippingAddress, {when: ({valueOf}) => valueOf(schemaPath.sameAsBilling)});

  // Readonly
  readonly(schemaPath.username);
});

Binding

Import FormField and use the [formField] directive.

import {FormField} from '@angular/forms/signals';

All props on state, such as disabled, hidden, readonly and name are bound automatically. Do NOT bind the name field.

CRITICAL: FORBIDDEN ATTRIBUTES When using [formField], you MUST NOT set the following attributes in the template (either static or bound):

  • min, max (Use validators in the schema instead)

  • value, [value], [attr.value] on text/number/date inputs (Already handled by [formField])

  • [attr.min], [attr.max]

  • [disabled], [readonly] (Already handled by [formField])

Exception: Static value on <input type="radio"> and <input type="checkbox"> is allowed and required — it identifies which option the input represents, not the bound field value.

<!-- CORRECT: value on radio specifies which option this button represents -->
<input type="radio" value="economy" [formField]="bookingForm.package.tier" />

<!-- WRONG: value binding on a regular input -->
<input [value]="someVar" [formField]="form.name" />

Do NOT do this: <input min="1" [formField]> or <input [value]="val" [formField]>.

<!-- Input -->
<input [formField]="userForm.name" />

<!-- Checkbox -->
<input type="checkbox" [formField]="userForm.isAdmin" />

<!-- Select -->
<select [formField]="userForm.country">
  <option value="us">US</option>
</select>

<!-- userForm.name can NOT be nullable, because input does not accept null-->
<input [formField]="userForm.name" />

Reactive Forms

Do NOT import FormControl, FormGroup, FormArray, or FormBuilder from @angular/forms. Signal Forms replace these concepts entirely. Signal forms does NOT have a builder.

Accessing State

Each field in the form is a function that returns its state.

// Access the field by calling it
const emailState = this.userForm.email();

// Value (WritableSignal)
const value = this.userForm().value();

// Validation State (Signals)
const isValid = this.userForm().valid();
const isInvalid = this.userForm().invalid();
const errors = this.userForm().errors(); // Array of errors
const error = this.userForm().getError('...'); // Single error, by error `kind`
const isPending = this.userForm().pending(); // Async validation pending

// Interaction State (Signals)
const isTouched = this.userForm().touched();
const isDirty = this.userForm().dirty();

// Availability State (Signals)
const isDisabled = this.userForm().disabled();
const isHidden = this.userForm().hidden();
const isReadonly = this.userForm().readonly();

IMPORTANT!: Make sure to call the field to get it state.

form().invalid()
form.field().dirty()
form.field.subfield().touched()
form.a.b.c.d().value()
form.address.ssn().pending()
form().reset()

// The only exception is length:
form.children.length
form.length // NOTE: no parenthesis!
form.client.addresses.length  // No "()"

@for (income of form.addresses; track $index) {/**/}

Submitting

Use the submit() function. It automatically marks all fields as touched before running the action.

CRITICAL: The callback to submit() MUST be async and MUST return a Promise.

import { submit } from '@angular/forms/signals';

// CORRECT - async callback
onSubmit() {
  submit(this.userForm, async () => {
    // This only runs if the form is valid
    await this.apiService.save(this.userModel());
    console.log('Saved!');
  });
}

// WRONG - missing async keyword
onSubmit() {
  submit(this.userForm, () => {  // ERROR: must be async
    console.log('Saved!');
  });
}

Handling Errors

field().errors() returns the errors array of ValidationError:

interface ValidationError {
  readonly kind: string;
  readonly message?: string;
}

field().getError('...') returns a single ValidationError by its kind.

Do NOT return null from validators. When there are no errors, return undefined

Context

Functions passed to rules like validate(), disabled(), applyWhen take a context object. It is CRITICAL to understand its structure:

validate(
  schemaPath.username,
  ({
    value, // Signal<T>: Writable current value of the field
    fieldTree, // FieldTree<T>: Sub-fields (if it's a group/array)
    state, // FieldState<T>: Access flags like state.valid(), state.dirty()
    valueOf, // (path) => T: Read values of OTHER fields (tracking dependencies), e.g. valueOf(schemaPath.password)
    stateOf, // (path) => FieldState: Access state (valid/dirty) of OTHER fields, e.g. stateOf(schemaPath.password).valid()
    pathKeys, // Signal<string[]>: Path from root to this field
  }) => {
    // WRONG: if (touched()) ... (touched is not in context)
    // RIGHT: if (state.touched()) ...

    if (value() === 'admin') {
      return {kind: 'reserved', message: 'Username admin is reserved'};
    }
  },
);
IMPORTANT: Paths are NOT Signals

Inside the form() callback, schemaPath and its children (e.g., schemaPath.user.name) are NOT signals and are NOT callable.

// WRONG - This will throw an error:
applyWhen(p.ssn, () => p.ssn().touched(), (ssnField) => { ... });

// RIGHT - Use stateOf() to get the state of a path:
applyWhen(p.ssn, ({ stateOf }) => stateOf(p.ssn).touched(), (ssnField) => { ... });

// RIGHT - Use valueOf() to get the value of a path:
applyWhen(p.ssn, ({ valueOf }) => valueOf(p.ssn) !== '', (ssnField) => { ... });
Multiple Items
  • Use applyEach for applying rules per item.

  • CRITICAL: applyEach callback takes ONLY ONE argument (the item path), NOT two:

// CORRECT - single argument
applyEach(s.items, (item) => {
  required(item.name);
});

// WRONG - do NOT pass index
applyEach(s.items, (item, index) => {
  // ERROR: callback takes 1 argument
  required(item.name);
});
  • In the template use @for to iterate over the items.

  • To remove an item from an array, just remove appropriate item from the array in the data.

  • select binding: You CAN bind to <select [formField]="form.country">. Ensure options have value attributes.

Nested @for Loops

CRITICAL: Angular does NOT have $parent. In nested loops, store outer index in a variable:

<!-- WRONG - $parent does not exist -->
@for (item of form.items; track $index) { @for (option of item.options; track $index) {
<button (click)="removeOption($parent.$index, $index)">Remove</button>
<!-- ERROR -->
} }

<!-- CORRECT - use let to store outer index -->
@for (item of form.items; track $index; let outerIndex = $index) { @for (option of item.options;
track $index) {
<button (click)="removeOption(outerIndex, $index)">Remove</button>
} }
Disabling Form Button
<button [disabled]="form().invalid() || form().pending()" />
<!-- Or -->
<button [disabled]="taxForm.invalid()" />

Do NOT use [disabled] on an input. [formField] will do this. Do NOT use [readonly] on an input. [formField] will do this. If you need to disable or readonly a field, use disabled() or readonly() rules in the schema.

Async Validation

Do not use validate() for async, instead use validateAsync():

CRITICAL:

  1. The params option MUST be a function that returns the value to validate.

  2. The onError handler is REQUIRED - it is NOT optional!

import {resource} from '@angular/core';
import {validateAsync} from '@angular/forms/signals';

userForm = form(this.userModel, (s) => {
  validateAsync(s.username, {
    // 1. MUST be a function - params takes context and returns the value
    params: ({value}) => value(),

    // 2. Create the resource - factory receives a Signal
    factory: (username) =>
      resource({
        params: username, // Use 'params' in resource()
        loader: async ({params: value}) => {
          await new Promise((resolve) => setTimeout(resolve, 1000));
          return value === 'taken';
        },
      }),

    // 3. Map success to errors
    onSuccess: (isTaken) =>
      isTaken ? {kind: 'taken', message: 'Username is already taken'} : undefined,

    // 4. Handle errors - THIS IS REQUIRED!
    onError: () => ({kind: 'error', message: 'Validation failed'}),
  });
});

WRONG Examples:

// WRONG - params must be a function
validateAsync(s.username, {
  params: s.username, // ERROR: must be ({ value }) => value()
  // ...
});

// WRONG - missing onError (it's required!)
validateAsync(s.username, {
  params: ({value}) => value(),
  factory: (username) => resource({/* ... */}),
  onSuccess: (result) => (result ? {kind: 'error'} : undefined),
  // ERROR: 'onError' is missing but required!
});
Using Resource

CRITICAL: In Angular's resource(), use params for the input signal.

// CORRECT
resource({
  params: mySignal,
  loader: async ({params: value}) => {
    /* ... */
  },
});

// WRONG
resource({
  request: mySignal, // ERROR: should be 'params'
  loader: async ({request}) => {
    /* ... */
  },
});

Use debounce() to delay synchronization between the UI and the model.

import {debounce} from '@angular/forms/signals';

userForm = form(this.userModel, (s) => {
  // Delay model updates by 300ms
  debounce(s.username, 300);
});
Conditional Validation
form(this.model, (path) => {
  applyWhen(
    path.name,
    ({value}) => value().first !== 'admin',
    (namePath) => {
      required(namePath.last);
      disabled(namePath.last, {when: ({valueOf}) => valueOf(path.locked)});
    },
  );
});

applyWhen passes the path mapped to the first argument. If you need parent field, just pass it to applyWhen:

form(this.model, (path) => {
  applyWhen(
    path.cat,
    ({value}) => value().name !== 'admin',
    (catPath) => {
      required(catPath.age);
    },
  );
});

Common Pitfalls (DO NOT DO THESE)

Error ScenarioWRONG (Common Mistake)RIGHT (Correct Way)
Accessing Flagsform.field.valid()form.field().valid()
Accessing valueform.field.value()form.field().value()
Setting valueform.field.set(x)Update model signal: this.model.update(...)
Form root flagsform.invalid()form().invalid()
Double-callingform.field()()form.field().value()
Rules Context({ touched }) => touched()({ state }) => state.touched()
Calling PathsapplyWhen(p.foo, () => p.foo() === 'x')applyWhen(p.foo, ({ valueOf }) => valueOf(p.foo) === 'x')
applyWhen argsapplyWhen(condition, () => {...})applyWhen(path, condition, schemaFn) - needs 3 args
Array lengthform.items().lengthform.items.length (structural)
Multi-select array<select multiple [formField]="form.labels"><select multiple> is unsupported. Use one boolean field + checkbox per option
readonly attribute<input readonly [formField]>Use readonly() rule in schema
min/max attributes<input min="1" max="10">Use min() and max() rules in schema
value binding<input [value]="val">Do NOT use [value] with [formField] (static value on radio/checkbox is OK)
Submit callbacksubmit(form, () => { ... })submit(form, async () => { ... })
Async paramsparams: s.fieldparams: ({ value }) => value()
Async onErrorOmitting onErroronError is REQUIRED in validateAsync
resource() APIrequest: signalparams: signal
applyEach argsapplyEach(s.items, (item, index) => ...)applyEach(s.items, (item) => ...)
Nested @for$parent.$indexUse let outerIndex = $index
FormState importimport { FormState }FormState does not exist, use FieldState
Null in modelsignal({ name: null })signal({ name: '' }) or signal({ age: 0 })
Validate syntaxvalidate(s.field, { value } => ...)validate(s.field, ({ value }) => ...)
Checkbox Array[formField]="form.tags" (string[])Checkboxes ONLY bind to boolean: one boolean field per option

Big Form Example

src/app/app.ts
import {Component, signal} from '@angular/core';
import {
  form,
  FormField,
  submit,
  required,
  email,
  min,
  hidden,
  applyEach,
  validate,
} from '@angular/forms/signals';

@Component({
  selector: 'app-root',
  imports: [FormField],
  templateUrl: './app.html',
})
export class App {
  protected readonly model = signal({
    personalInfo: {
      firstName: '',
      lastName: '',
      email: '',
      age: 0,
    },
    tripDetails: {
      destination: 'Mars',
      launchDate: '',
    },
    package: {
      tier: 'economy',
      extras: {wifi: false, gym: false},
    },
    companions: [] as Array<{name: string; relation: string}>,
  });

  protected readonly bookingForm = form(this.model, (s) => {
    required(s.personalInfo.firstName, {message: 'First name is required'});
    required(s.personalInfo.lastName, {message: 'Last name is required'});
    required(s.personalInfo.email, {message: 'Email is required'});
    email(s.personalInfo.email, {message: 'Invalid email address'});
    required(s.personalInfo.age, {message: 'Age is required'});
    min(s.personalInfo.age, 18, {message: 'Must be at least 18'});

    required(s.tripDetails.destination);
    required(s.tripDetails.launchDate);
    validate(s.tripDetails.launchDate, ({value}) => {
      const date = new Date(value());
      if (isNaN(date.getTime())) return undefined;
      const today = new Date();
      if (date < today) {
        return {kind: 'pastData', message: 'Launch date must be in the future'};
      }
      return undefined;
    });

    // valueOf is used to access values of other fields in rules
    hidden(s.package.extras, {when: ({valueOf}) => valueOf(s.package.tier) === 'economy'});

    applyEach(s.companions, (companion) => {
      required(companion.name, {message: 'Companion name required'});
      required(companion.relation, {message: 'Relation required'});
    });
  });

  addCompanion() {
    this.model.update((m) => ({
      ...m,
      companions: [...m.companions, {name: '', relation: ''}],
    }));
  }

  removeCompanion(index: number) {
    this.model.update((m) => ({
      ...m,
      companions: m.companions.filter((_, i) => i !== index),
    }));
  }

  onSubmit() {
    // CRITICAL: submit callback MUST be async
    submit(this.bookingForm, async () => {
      console.log('Booking Confirmed:', this.model());
      // If you need to do async work:
      // await this.apiService.save(this.model());
    });
  }
}
src/app/app.html
<form (submit)="onSubmit(); $event.preventDefault()">
  <h1>Interstellar Booking</h1>

  <section>
    <h2>Personal Info</h2>

    <label>
      First Name
      <input [formField]="bookingForm.personalInfo.firstName" />
      @if (bookingForm.personalInfo.firstName().touched() &&
      bookingForm.personalInfo.firstName().errors().length) {
      <span>{{ bookingForm.personalInfo.firstName().errors()[0].message }}</span>
      }
    </label>

    <label>
      Last Name
      <input [formField]="bookingForm.personalInfo.lastName" />
      @if (bookingForm.personalInfo.lastName().touched() &&
      bookingForm.personalInfo.lastName().errors().length) {
      <span>{{ bookingForm.personalInfo.lastName().errors()[0].message }}</span>
      }
    </label>

    <label>
      Email
      <input type="email" [formField]="bookingForm.personalInfo.email" />
      @if (bookingForm.personalInfo.email().touched() &&
      bookingForm.personalInfo.email().errors().length) {
      <span>{{ bookingForm.personalInfo.email().errors()[0].message }}</span>
      }
    </label>

    <label>
      Age
      <input type="number" [formField]="bookingForm.personalInfo.age" />
      @if (bookingForm.personalInfo.age().touched() &&
      bookingForm.personalInfo.age().errors().length) {
      <span>{{ bookingForm.personalInfo.age().errors()[0].message }}</span>
      }
    </label>
  </section>

  <section>
    <h2>Trip Details</h2>

    <label>
      Destination
      <select [formField]="bookingForm.tripDetails.destination">
        <option value="Mars">Mars</option>
        <option value="Moon">Moon</option>
        <option value="Titan">Titan</option>
      </select>
    </label>

    <label>
      Launch Date
      <input type="date" [formField]="bookingForm.tripDetails.launchDate" />
      @if (bookingForm.tripDetails.launchDate().touched() &&
      bookingForm.tripDetails.launchDate().errors().length) {
      <span>{{ bookingForm.tripDetails.launchDate().errors()[0].message }}</span>
      }
    </label>
  </section>

  <section>
    <h2>Package</h2>

    <label>
      <input type="radio" value="economy" [formField]="bookingForm.package.tier" />
      Economy
    </label>
    <label>
      <input type="radio" value="business" [formField]="bookingForm.package.tier" />
      Business
    </label>
    <label>
      <input type="radio" value="first" [formField]="bookingForm.package.tier" />
      First Class
    </label>

    @if (!bookingForm.package.extras().hidden()) {
    <div>
      <h3>Extras</h3>
      <!-- Multiple choices: one boolean field per option, bound to a checkbox -->
      <label>
        <input type="checkbox" [formField]="bookingForm.package.extras.wifi" />
        WiFi
      </label>
      <label>
        <input type="checkbox" [formField]="bookingForm.package.extras.gym" />
        Gym
      </label>
    </div>
    }
  </section>

  <section>
    <h2>Companions</h2>
    <button type="button" (click)="addCompanion()">Add Companion</button>

    @for (companion of bookingForm.companions; track $index) {
    <div>
      <input [formField]="companion.name" placeholder="Name" />
      @if (companion.name().touched() && companion.name().errors().length) {
      <span>{{ companion.name().errors()[0].message }}</span>
      }

      <input [formField]="companion.relation" placeholder="Relation" />
      @if (companion.relation().touched() && companion.relation().errors().length) {
      <span>{{ companion.relation().errors()[0].message }}</span>
      }

      <button type="button" (click)="removeCompanion($index)">Remove</button>
    </div>
    }
  </section>

  <button [disabled]="bookingForm().invalid()">Submit</button>
</form>

Recovering from Build Errors

If you encounter build errors, here are the most common fixes:

Property 'value' does not exist on type 'FieldTree'

Problem: Accessing .value() directly on a field without calling it first.

// WRONG
const val = this.form.field.value();
// RIGHT
const val = this.form.field().value();
Property 'set' does not exist on type 'FieldTree'

Problem: Trying to set values on the form tree. Signal Forms are model-driven.

// WRONG
this.form.address.street.set('Main St');
// RIGHT - update the model signal instead
this.model.update((m) => ({...m, address: {...m.address, street: 'Main St'}}));
Type 'string[]' is not assignable to type 'string'

Problem: Binding [formField] to an array field with a <select>. The native <select> control only supports a single string value, and <select multiple> is not supported by [formField].

<!-- WRONG - assignees is string[], select expects string -->
<select [formField]="form.assignees">
  ...
</select>

<!-- ALSO WRONG - <select multiple> is not supported by [formField] -->
<select multiple [formField]="form.assignees">
  ...
</select>

<!-- RIGHT - Model each option as its own boolean field, bound to a checkbox (see below) -->
NG8022: Setting the 'readonly/min/max/value' attribute is not allowed

Problem: Conflict between HTML attributes and [formField] directive.

<!-- WRONG -->
<input [formField]="form.age" min="18" max="99" />
<input [formField]="form.name" [value]="'John'" />

<!-- RIGHT - Use rules in schema -->
min(s.age, 18); max(s.age, 99); // Then just:
<input [formField]="form.age" />
TS2322: Type 'string[]' is not assignable to type 'boolean'

Problem: Binding a checkbox to an array field instead of a boolean field.

<!-- WRONG - tags is string[] -->
<input type="checkbox" [formField]="form.tags" />

<!-- RIGHT - Map each option to a boolean field in the model -->
protected readonly model = signal({ hasWifi: false, hasGym: false });
<input type="checkbox" [formField]="form.hasWifi" />
<input type="checkbox" [formField]="form.hasGym" />
Expected 3 arguments, but got 2 for applyWhen

Problem: Missing the path argument in applyWhen.

// WRONG
applyWhen(isJoint, () => { ... });

// RIGHT - applyWhen(path, condition, schemaFn)
applyWhen(s.spouse, ({valueOf}) => valueOf(s.status) === 'joint', (spousePath) => {
  required(spousePath.name);
});
Module has no exported member 'FormState'

Problem: Importing a non-existent type.

// WRONG
import {FormState} from '@angular/forms/signals';

// FormState does not exist. If you need type access, the form
// instance provides all necessary state through field().valid(), etc.
No pipe found with name 'number' / 'json' / 'date'

Problem: Using pipes in templates.

<!-- WRONG -->
{{ totalPrice() | number:'1.2-2' }}

<!-- RIGHT - format in the component -->
protected readonly totalPriceFormatted = computed(() => this.totalPrice().toFixed(2));
<!-- then: -->
{{ totalPriceFormatted() }}
$parent.$index in nested @for loops

Problem: Angular doesn't have $parent.

<!-- WRONG -->
@for (item of items; track $index) { @for (sub of item.subs; track $index) {
<button (click)="remove($parent.$index, $index)">X</button>
} }

<!-- RIGHT -->
@for (item of items; track $index; let outerIdx = $index) { @for (sub of item.subs; track $index) {
<button (click)="remove(outerIdx, $index)">X</button>
} }

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server, Needs Node.js

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
Google LLC
Publisher
Angular (Google) (Official)
Distributed by
Angular (Google)
Source
angular/skills · angular-developer · commit 9274c6e
Licence
MIT License (redistribution allowed)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google LLC or Angular (Google).

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download angular-developer.zip