Angular Calendar - Handle the Value Change Event

To process a new calendar value, you need to handle the value change event. If the handling function is not going to be changed during the lifetime of the UI component, assign it to the onValueChanged property when you configure the UI component.

HTML
TypeScript
  • <dx-calendar ...
  • [(value)]="calendar_value"
  • (onValueChanged)="calendar_valueChanged($event)">
  • </dx-calendar>
  • import { DxCalendarModule } from "devextreme-angular";
  • // ...
  • export class AppComponent {
  • calendar_value: Date = new Date();
  •  
  • calendar_valueChanged (e) {
  • const previousValue = e.previousValue;
  • const newValue = e.value;
  • // Event handling commands go here
  • }
  • }
  • @NgModule({
  • imports: [
  • // ...
  • DxCalendarModule
  • ],
  • // ...
  • })
See Also