angular-material-components
angular-material-components copied to clipboard
No daySelected event emit
No daySelected
, I have check on https://github.com/h2qutc/angular-material-components/blob/f147c1c9645167fb170bbca4aa9d91f757c2bb5a/projects/datetime-picker/src/lib/datetime-picker.component.ts
It just has monthSelected
& yearSelectd
@samnangcattor here you go some workaround:
`
@ViewChild('picker', { static: true }) datepicker!: NgxMatDatetimePicker
private _sub$: Subject
detectChanges() { this.options['detectChanges']?.(this.field); }
ngOnDestroy() { super.ngOnDestroy(); }
ngAfterViewInit() { super.ngAfterViewInit(); this.to[this.to.datepickerOptions.datepickerTogglePosition] = this.datepickerToggle; this.dayClickHandler(); }
dayClickHandler() { const onCellClick = (event: PointerEvent) => { if ( (event.target as HTMLElement).classList.contains( 'mat-calendar-body-cell-content' ) ) { this.to?.datepickerOptions?.daySelected( this.field, this.datepicker._selected ); console.log(this.datepicker); } }; let popupRef: HTMLElement; this.datepicker.openedStream.pipe(takeUntil(this._sub$)).subscribe(() => { popupRef = this.datepicker._popupRef.overlayElement; popupRef.addEventListener('click', onCellClick); }); this.datepicker.closedStream.pipe(takeUntil(this._sub$)).subscribe(() => { popupRef?.removeEventListener('click', onCellClick); }); } `