This situation is straightforward
I am dealing with a reference in this format
@ViewChild('myElement') myElementVar : SomeClass;
The element I am referencing appears like this
<element #myElement *ngIf="someBoolean"></element>
As someBoolean
turns false, myElementVar
becomes undefined, I understand that this happens because *ngIf
completely removes the element from the DOM, causing the reference to be lost.
My inquiry is whether it is viable to re-assign myElementVar
to #myElement
when someBoolean
becomes true again.