Topic: Date picker with reactive forms?

Andrew pro asked 5 years ago


Is it possible to use the date picker with reactive forms? I only see a reference to ngModel not formControlName.

Arkadiusz Idzikowski staff answered 2 years ago


There is an information about how to use the reactive forms with reactive forms in our documentation. Please take a look at the second example in this section (if you don't want to set default value, just remove the value from FormControl): https://mdbootstrap.com/docs/angular/forms/date-picker/#default-value

In case of any further problems please provide some more details.


BruceVWilcox pro answered 2 years ago


It is January 2020 and data binding still does not work when I try to use mdb-date-picker in a reactive form. The documentation at 'https://mdbootstrap.com/docs/angular/forms/date-picker/' is silent on the subject. IMO the documentation should either (1) affirmatively indicate it does not work for reactive forms or (2) provide an example of how to make it work. Thank you.


ocera002 free answered 5 years ago


Does it already work with reactive forms?

Andrew pro commented 5 years ago

Yes. `formControlName` works for me.

pro answered 5 years ago


Yes, The Date picker partially works with reactive form. The below statement will not bind the date value to the control: this.formBuilder.group({datepicker: ['1990-01-01']});

Rafał Rogulski free answered 5 years ago


Hi, We will fix this in next release. Regards

pro answered 5 years ago


I have tried to use formControlName and it does work

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • User: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags