# Angular: NG01203: No value accessor for form control with name: 'x' (ControlValueAccessor missing)

**Code:** `NG01203` · **Category:** Angular · **Seen on:** Angular, TypeScript

A form directive (`formControlName`, `ngModel`) is on an element or component that Angular cannot read/write values from.

## Meaning

Angular forms need a `ControlValueAccessor`. Native inputs have one once `FormsModule` / `ReactiveFormsModule` is imported. Custom components must implement `ControlValueAccessor` and register `NG_VALUE_ACCESSOR`, and third-party components (Material, PrimeNG) need their own module imported.

## Common causes

- `FormsModule` or `ReactiveFormsModule` not imported, so native inputs have no accessor
- `formControlName` / `ngModel` placed on a component that does not implement `ControlValueAccessor`
- `NG_VALUE_ACCESSOR` provider missing in a custom control
- Wrong element (a `div` instead of `input`)
- Library form module not imported

## Quick fix

1. Import `ReactiveFormsModule` or `FormsModule`
2. Implement `ControlValueAccessor` and provide `NG_VALUE_ACCESSOR` with `forwardRef`
3. Put the directive on the real input element

## Detailed fix by platform

### Angular

1. `providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => StarRatingComponent), multi: true }]` on the custom control
2. Check the library docs for the module that provides the accessor

## Code examples

### Minimal custom control

```typescript
@Component({
  selector: 'app-star-rating', standalone: true,
  template: `<button *ngFor="let s of [1,2,3,4,5]" (click)="set(s)">★</button>`,
  providers: [{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => StarRatingComponent), multi: true }],
})
export class StarRatingComponent implements ControlValueAccessor {
  value = 0; onChange = (_: number) => {}; onTouched = () => {};
  writeValue(v: number) { this.value = v ?? 0; }
  registerOnChange(fn: any) { this.onChange = fn; }
  registerOnTouched(fn: any) { this.onTouched = fn; }
  set(v: number) { this.value = v; this.onChange(v); }
}
```

## How to diagnose

1. **Element** — Native input or custom component?
2. **Module** — Forms module imported?
3. **Accessor** — ControlValueAccessor implemented and provided?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/angular/no-value-accessor-form-control)
