Behebung von Angular 'Cannot find control with unspecified name attribute'

English Deutsch

Problem:

In deiner Angular2/4/5-Anwendung siehst du diese Fehlermeldung:

angular_error.txt
Cannot find control with unspecified name attribute

Lösung

Suche nach einer Anweisung im HTML-Angular-Template wie dieser:

template_example.html
[formControl]="myCtrl"

Die Fehlermeldung bedeutet, dass myCtrl nicht gefunden werden kann. Prüfe, ob diese Variable in deiner Klasse vorhanden ist — sie muss ein FormControl sein, das du aus @angular/forms importieren kannst:

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

In meinem Fall hat die Änderung auf

template_fixed.html
[formControl]="myControl"

das Problem behoben


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