bleenco / ng2-datepicker

Angular2 Datepicker Component
http://ng2-datepicker.jankuri.com
MIT License
311 stars 236 forks source link

How to clear selected date from UI? #344

Open sakhisoufiane opened 5 years ago

sakhisoufiane commented 5 years ago

It's been mentioned that this feature has been added, but we can't figure out how to implement it ? Anyone knows a way to clear the selected date from the ui ?

maghidini commented 5 years ago

I added a template reference on the tag <ng-datepicker> and the use reset() method on my component.

HTML: <ng-datepicker #date></ng-datepicker>

COMPONENT:

@ViewChild('date') date: ElementRef;

resetDate() {
    this.date.reset();
}