I\'m trying to access a native element in order to focus on it when another element is clicked (much like the html attribute \"for\" - for cannot be used on elements of th
Sometimes, this error occurs when you're trying to target an element that is wrapped in a condition, for example:
Targeted Element
In this code, if canShow is false on render, Angular won't be able to get that element as it won't be rendered, hence the error that comes up.
One of the solutions is to use a display: hidden on the element instead of the *ngIf so the element gets rendered but is hidden until your condition is fulfilled.
Read More over at Github