0👍
Without a proper recreation on StackBlitz, it’s hard to debug. But it does appear that the drawDay
variable that you reference in your template doesn’t exist in your TypeScript file.
Similarly, when toggling a conditionally rendered element like that the DOM actually has to play catch up before the element that you’re referencing with your @ViewChild
annotation is available. Typically, you can get around this by wrapping your code in a setTimeout()
as that will push the code to the back of the event queue (which means the browser will render the content first and then execute the code).
Source:stackexchange.com