Skip to content
Back to skills

Angular Forms

ASecurity

Angular Reactive Forms for form building, validation, and state management. Use when creating forms, implementing validators, handling form submissions, building dynamic forms, or integrating forms with NgRx Signals in Angular applications. Covers FormControl, FormGroup, and FormArray.

  • 225 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 4, 2026
developmenttypescriptreactangulardocumentation

Security analysis

A100/100

Pro scans all 13 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add NeverSight/skills_feed --skill angular-forms --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Angular Forms?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Angular Forms
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/neversight-angular-forms/badge)](https://www.skillsdirectory.com/skills/neversight-angular-forms)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: angular-forms
description: Angular Reactive Forms for form building, validation, and state management. Use when creating forms, implementing validators, handling form submissions, building dynamic forms, or integrating forms with NgRx Signals in Angular applications. Covers FormControl, FormGroup, and FormArray.
license: Complete terms in LICENSE.txt
---

# Angular Forms Skill

## Rules

### Form Creation
- Use `ReactiveFormsModule` for reactive forms
- Use `FormControl` for individual form fields
- Use `FormGroup` to group multiple form controls
- Use `FormArray` for dynamic lists of form controls
- Use `FormBuilder` for simplified form creation

### Validation
- Use built-in validators: `Validators.required`, `Validators.email`, `Validators.min`, `Validators.max`, `Validators.pattern`
- Custom validators MUST return `ValidationErrors | null`
- Show validation errors ONLY after field is touched
- Disable submit button when form is invalid

### Form State Management
- Check form state: `valid`, `invalid`, `touched`, `dirty`, `pristine`
- Reset form using `form.reset()`
- Update form values using `form.patchValue()` or `form.setValue()`

### NgRx Signals Integration
- Store form instance in `signalStore` state
- Use `rxMethod` for async form submission
- Use `tapResponse` for handling submission success/error
- Reset form on successful submission

### Form Submission
- Use `(ngSubmit)` event for form submission
- Validate form before processing: `if (form.valid)`
- Handle errors with user feedback

---

## Context

### Summary
Angular Reactive Forms provide a model-driven approach to handling form inputs with built-in validation, state management, and integration with Angular's reactive programming patterns.

### When to Use This Skill

Activate this skill when you need to:
- Create reactive forms with FormControl and FormGroup
- Implement built-in and custom validators
- Handle form submissions and data binding
- Build dynamic forms with FormArray
- Implement cross-field validation
- Integrate forms with NgRx Signals stores
- Handle async validators
- Implement form state management (touched, dirty, valid)
- Create reusable form components

### Basic Reactive Form Example

```typescript
import { Component } from '@angular/core';
import { ReactiveFormsModule, FormControl, FormGroup, Validators } from '@angular/forms';

@Component({
  selector: 'app-user-form',
  standalone: true,
  imports: [ReactiveFormsModule],
  template: `
    <form [formGroup]="userForm" (ngSubmit)="onSubmit()">
      <input formControlName="name" placeholder="Name">
      @if (userForm.controls.name.touched && userForm.controls.name.errors) {
        <span>Name is required</span>
      }
      
      <input formControlName="email" type="email" placeholder="Email">
      @if (userForm.controls.email.touched && userForm.controls.email.errors?.['email']) {
        <span>Invalid email</span>
      }
      
      <button type="submit" [disabled]="userForm.invalid">Submit</button>
    </form>
  `
})
export class UserFormComponent {
  userForm = new FormGroup({
    name: new FormControl('', [Validators.required]),
    email: new FormControl('', [Validators.required, Validators.email])
  });
  
  onSubmit() {
    if (this.userForm.valid) {
      console.log(this.userForm.value);
    }
  }
}
```

### Custom Validators Example

```typescript
// Custom validator function
function minAgeValidator(minAge: number): ValidatorFn {
  return (control: AbstractControl): ValidationErrors | null => {
    if (!control.value) return null;
    
    const birthDate = new Date(control.value);
    const age = new Date().getFullYear() - birthDate.getFullYear();
    
    return age >= minAge ? null : { minAge: { required: minAge, actual: age } };
  };
}

// Usage
age: new FormControl('', [Validators.required, minAgeValidator(18)])
```

### Integration with NgRx Signals Example

```typescript
export const UserFormStore = signalStore(
  { providedIn: 'root' },
  withState({
    form: new FormGroup({
      name: new FormControl(''),
      email: new FormControl('')
    }),
    submitting: false,
    error: null as string | null
  }),
  withMethods((store, userService = inject(UserService)) => ({
    submitForm: rxMethod<void>(
      pipe(
        tap(() => patchState(store, { submitting: true })),
        switchMap(() => userService.createUser(store.form().value)),
        tapResponse({
          next: () => {
            store.form().reset();
            patchState(store, { submitting: false });
          },
          error: (error: Error) => patchState(store, { 
            error: error.message, 
            submitting: false 
          })
        })
      )
    )
  }))
);
```

### References

- [Angular Forms Documentation](https://angular.dev/guide/forms)
- [Form Validation](https://angular.dev/guide/forms/form-validation)

Files in this skill

  • SKILL.md4.8 KB
  • description_ar.txt482 B
  • description_cn.txt266 B
  • description_de.txt369 B
  • description_en.txt287 B
  • description_es.txt311 B
  • description_fr.txt413 B
  • description_it.txt357 B
  • description_ja.txt382 B
  • description_ko.txt304 B
  • description_ru.txt476 B
  • description_tw.txt266 B
  • stats.json65 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.