fetrarij / ngx-daterangepicker-material

Pure Angular 2+ date range picker with material design theme, a demo here:
https://fetrarij.github.io/ngx-daterangepicker-material/
MIT License
246 stars 247 forks source link

How to disable apply and Reset buttons #432

Open webgunti05 opened 2 years ago

webgunti05 commented 2 years ago

Hi, could please provide me the fix to disable / Enable the apply and Reset buttons until we select both start and end dates vice versa ?

zhe1ka commented 2 years ago

+1

joyetgeorge commented 1 year ago

+1

kdsonit commented 1 year ago

@webgunti05 try with this

@ViewChild(DaterangepickerDirective, { static: false }) pickerDirective!: DaterangepickerDirective;

ngAfterViewInit(): void {
    this.pickerDirective.startDateChanged.subscribe(() => {
      this.pickerDirective.picker.applyBtn.disabled = true;
    });
    this.pickerDirective.endDateChanged.subscribe(() => {
      this.pickerDirective.picker.applyBtn.disabled = false;
    });
  }