Hi,
I am using msbc-eventcalendar
in Angular and want to control the selectedDate
property. However, in my setup, the scroll suffers from this and is scrolling back and forth as described by this bug report.
I am using two-way-binding as recommended by the documentation, but this also applies to a setup where the property is controlled via [selectedDate]
and (onSelectedDateChange)
in combination.
The setup looks like this:
component.html
<mbsc-eventcalendar [data]="myEvents" [options]="eventSettings" [(selectedDate)]="day"></mbsc-eventcalendar>
component.ts
import { Component, OnInit } from '@angular/core';
import { MbscEventcalendarOptions, Notifications, MbscCalendarEvent, localeDe } from '@mobiscroll/angular';
import { HttpClient } from '@angular/common/http';
@Component({
selector: 'app-root',
templateUrl: './app.component.html'
})
export class AppComponent implements OnInit {
constructor(private http: HttpClient, private notify: Notifications) {}
myEvents: MbscCalendarEvent[] = [];
eventSettings: MbscEventcalendarOptions = {
locale: localeDe,
theme: 'ios',
themeVariant: 'light',
view: {
calendar: { type: 'month' },
agenda: { type: 'month' }
},
onEventClick: (event) => {
this.notify.toast({
message: event.event.title
});
}
};
ngOnInit(): void {
this.http.jsonp<MbscCalendarEvent[]>('https://trial.mobiscroll.com/events/?vers=5', 'callback').subscribe((resp: any) => {
this.myEvents = resp;
});
}
}
Thanks in advance!