Hi, i have a question about if is there an event that triggers when a different date on a calendar is selected?. Below attached the image, e.x i want to choose november 15, is there any event that return that date? i have a mini database where there are appintmente so, i want to retrieve only appointments of this day. Thanks
You can use a calendar change event for your requirement, and that will be triggered when the calendar value is changed.
[app.component.html]
|
<div id="container"> <ejs-calendar (change)="onValueChange($event)"></ejs-calendar> <span id="selected">Selected Value: </span> </div> |
[app.component.ts]
|
onValueChange(args: any): void { /*Displays selected date in the label*/ (<HTMLInputElement>document.getElementById('selected')).textContent = 'Selected Value: ' + args.value; } |
API Documentation : https://ej2.syncfusion.com/angular/documentation/api/calendar#change
Sample : https://stackblitz.com/edit/angular-dqmvzg?file=app.component.html,app.component.ts
Thanks!, but is not working , and i'm suspecting is because i have <ejs-schedule> not <ejs-calendar>, because if i change in stackblitz what i'm mentioning it throws an error. this is my html
You can get the selected date value from the navigating event of the Schedule, as shown in the below code snippet.
Sample: https://stackblitz.com/edit/ej2-angular-schedule-get-selected-date-on-date-nav?file=app.component.ts
API: https://ej2.syncfusion.com/angular/documentation/api/schedule/#navigating
[app.component.ts]
|
public onNavigating(args) { if(args.action === 'date') { console.log('selected date: ', args.currentDate); } } |