search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Angular show() not working

Asked by Murry
10 months ago.

Hi DayPilot Support,
I was using heightSpec = Parent100Pct and need to recalculates the dimensions when other element was hide else the scheduler will leaves many blank space below

I was using DayPilot scheduler show() to do it and write it as a function to let button trigger it
https://api.daypilot.org/daypilot-scheduler-show/

@ViewChild('scheduler', { static: false }) scheduler: DayPilotSchedulerComponent;

public reSizeScheduler() {
    this.scheduler.control.show();
  }

However when i trigger this reSizeScheduler() will hit error of
ERROR TypeError: Cannot read property 'control' of undefined
Answer posted by Dan Letecky [DayPilot]
10 months ago.

In order to access the component using "this" you need to use the arrow function notation:

  reSizeScheduler = () => {
    this.scheduler.control.show();
  }

See also:
https://www.typescriptlang.org/docs/handbook/functions.html#this-parameters-in-callbacks

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.