Using formControlName with material-datepicker gives No value accessor for form control
Opened this issue · 3 comments
Please help me on below. I am using material-datepicker with reactive forms.
I am getting the following error when the form loads.
Error: No value accessor for form control with name: 'birthday'
at _throwError (shared.js:122) [angular]
at setUpControl (shared.js:35) [angular]
at FormGroupDirective.addControl (form_group_directive.js:124) [angular]
at FormControlName._setUpControl (form_control_name.js:193) [angular]
at FormControlName.ngOnChanges (form_control_name.js:111) [angular]
This is due to the fact the library doesn't use the ControlValueAccessor. I plan on forking and updating this as it seems development for this repo may be dead.
What you can do is wrap it with a component that implments ControlValueAccessor to have it work properly with NgModel and all the Angular/Form stuff.
https://blog.thoughtram.io/angular/2016/07/27/custom-form-controls-in-angular-2.html
This post has a really detailed example of what needs to be done.
Hope all is well,
C Layton
#105 is a PR made to solve this... Though maybe we all should just fork and solve this ourselves
Someone can watch this please ? https://stackoverflow.com/questions/50947642/angular-material-6-datepicker-reactive-form