Angular Forms: "No value accessor for …"


Using the AngularDart Material package. Could really use some help on this error:

“No value accessor for (username) or you may be missing formDirectives in your directives list.”

Minimal setup (formDirectives is specified in directives list):


<form (ngSubmit)="onSubmit()" #form="ngForm">
        <material-input class="username" ngControl="username" [(ngModel)]="username"


import 'package:angular/angular.dart';
import 'package:angular_components/angular_components.dart';
import 'package:angular_forms/angular_forms.dart';

  selector: 'login',
  styleUrls: const ['style.css'],
  templateUrl: 'login.html',
  directives: const [formDirectives,MaterialInputComponent,]
class LoginComponent {

  String username;
  void onSubmit() {}


You need the ControlValueAccessor for material-input in your directives list.

Better to use materialInputDirectives instead of MaterialInputComponent directly as it has the other directives you might want to use to interact with the value.

Answered By – Ted Sander

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *