I'm currently working on implementing a method call from one Angular component to another
Inside one.component.ts
, there is a task to verify if it's a day off
export class CalendarComponent implements OnInit {
isDayOfWeekDisabled(dayOfWeek: number): boolean {
let dateIsDisabled = false;
const workDay=
moment(this.viewDate).startOf('isoWeek').add(dayOfWeek, 'd');
this.disabledAreas.forEach((item) => {
if (item.start.isSame(moment(workDay)) &&
item.end.isSame(moment(workDay.endOf('day')))) {
dateIsDisabled = true;
}
});
return dateIsDisabled;
} }
On the other hand, in another.component.ts
; if the day off value is true, todos for that day should not be displayed:
filterDateInDisabledArea(): boolean {
for (const disabledArea of this.disabledAreas) {
if (isDayOfWeekDisabled()) {
return false;
}
}
return true;
}
However, I am facing challenges in establishing a connection between these components.