In Angular 2 with Ahead-of-Time (AOT) compiling, I have a parent component and a child component, like this:
<div>
<h1>I am a parent</h1>
<myChild *ngIf="showChild"></myChild>
</div>
I know that the child template is inserted to the DOM dynamically.
If showChild
is evaluated to false
, when exactly does Angular destroy the child component? Or will Angular destroy the child component at all? Is that the time Angular invokes the onDestroy()
method?