How to fix Angular 'Cannot find control with unspecified name attribute'

Problem:

In your Angular2/4/5 application you see this error message:

angular_error.txt
Cannot find control with unspecified name attribute

Solution

Look for a statement in the HTML angular template like this:

template_example.html
[formControl]="myCtrl"

The error message means that myCtrl can’t be found. Check if this variable is present in your class - it needs be a FormControl which you can import from @angular/forms:

import_formcontrol.ts
import { FormControl } from '@angular/forms';

In my case, changing it to

template_fixed.html
[formControl]="myControl"

fixed the issue


Check out similar posts by category: Angular, Javascript, Typescript