'infinite loop on loading workDays ejs-schedule
I am trying to load working days through a function, I need to load days by calling a function so that I can validate which days it works.
For all other parameters I can execute the method call waiting for logic processing and data return, only the [workDays]
parameter is looping.
If I create a public variable with a list it works, but I need to execute the method call to execute logic and then return a list.
component.ts:
public getWorkDays() {
// Even returning the ready list it is in a loop updating the calendar.
let workDays = [1,2,3];
return workDays;
}
component.html:
<ejs-schedule #scheduleObj width='100%' [views]="scheduleViews" [timeScale]="getTimeScale()"
[workDays]="getWorkDays()" locale="pt" [showWeekend]="showWeekend" [startHour]="getStartHour(product)"
[endHour]="getEndHour(product)" height='450' [currentView]="'Week'" [selectedDate]="selectedDate"
[eventSettings]="eventSettings" [rowAutoHeight]="true">
</ejs-schedule>
Solution 1:[1]
Use the below code example to overcome the reported issue.
https://stackblitz.com/edit/angular-wvhguq-r6jesc?file=app.component.ts
import { Component,ChangeDetectionStrategy } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [WeekService, MonthService, ResizeService, DragAndDropService],
**changeDetection**: ChangeDetectionStrategy.OnPush
})
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Dharman |