angulardart / angular_components

The official Material Design components for AngularDart. Used at Google in production apps.

Home Page:https://pub.dev/packages/angular_components

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The calendar doesn't automatically scroll to the current day

salojoo opened this issue · comments

MaterialCalendarPickerComponent opens to minDate by default, instead of scrolling to today

As a work-around one can reference the component with ViewChild, and scroll in OnInit()

@ViewChild(MaterialCalendarPickerComponent) MaterialCalendarPickerComponent calendarPickerComponent;

ngOnInit() async {
calendarPickerComponent.scrollToDate(Date.today());
}

My work-around maybe only works, because I have some async code for delay in the onInit function

So a better solution would be to use a timer

ngOnInit() {
Timer.run(() => calendarPickerComponent.scrollToDate(Date.today()));
}