Date picker with reactive forms?

web
mobile

Topic: Date picker with reactive forms?

Andrew pro asked 3 years ago

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

pro answered 3 years ago

I have tried to use formControlName and it does work
Hi, We will fix this in next release. Regards

pro answered 3 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']});

ocera002 answered 2 years ago

Does it already work with reactive forms?

Andrew pro commented 2 years ago

Yes. formControlName works for me.

BruceVWilcox pro answered 1 months 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.


Arkadiusz Idzikowski staff answered 1 months 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.


Please insert min. 20 characters.
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