kekeh / angular-mydatepicker

Angular datepicker and date range picker :date:
https://kekeh.github.io/angular-mydatepicker/
MIT License
1 stars 11 forks source link

How to set date in datepicker input-field #70

Closed joshi-anshul closed 3 years ago

joshi-anshul commented 3 years ago

Hello @kekeh

Date picker works very good, but I have a silly question :(

How can I set default date in date picker input field?

Thanks

kekeh commented 3 years ago

Hello @joshi-anshul

You have to use ngModel to set initial date. Set javascript date object or mydate object to ngModel. Here is an example: https://github.com/kekeh/angular-mydatepicker/wiki/initialize-date-model-(single-date-mode)

Check the ngOnInit() method from the example. It shows both of above methods.

Other examples: https://github.com/kekeh/angular-mydatepicker/wiki

joshi-anshul commented 3 years ago

@kekeh thanks a lot