[Solved] ERROR Error: No value accessor for form control with unspecified name attribute

(Last Updated On: October 12, 2017)

[Solved] ERROR Error: No value accessor for form control with unspecified name attribute

 

This issue will occur due to lot of reasons, here I am writing my case to help someone,

Issue:

This issue happened with angular 4 cli + angular material 2 for me.

I used mat-radio-button, mat-checkbox in my template page. But I missed to import the radio module and FormsModule in my app module.

Solutions:

Import all the respective modules in your module page [In this case MatCheckboxModule and MatRadioModule]. Ensure you have already imported FormsModule as well.

Issue code:

import { MatButtonModule, MatCheckboxModule, MatCardModule, MatInputModule } from ‘@angular/material’;
imports: [BrowserModule,BrowserAnimationsModule,MatButtonModule,MatCheckboxModule,FormsModule,HttpModule,MatCardModule,MatInputModule],
providers: [],
bootstrap: [AppComponent]
})

Resolved Code:

import { MatButtonModule, MatCheckboxModule, MatCardModule,MatInputModule, MatRadioModule } from ‘@angular/material’;
imports: [BrowserModule,BrowserAnimationsModule,MatButtonModule,MatCheckboxModule,FormsModule,HttpModule,MatCardModule,MatInputModule,MatRadioModule],
providers: [],
bootstrap: [AppComponent]
})

 

Hope it helps someone!

326 total views, 4 views today

Leave a Reply

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