I simplified my problem:
<div *ngIf="layout1" class="layout1">
<div class="sidebar-layout1">
some items
</div>
<child-component [something]="sth"></child-component>
</div>
<div *ngIf="!layout1" class="layout2">
<child-component [something]="sth">
<p>some content...</p>
</child-component>
</div>
I have a parent component which has the possibility of a normal layout (layout1) and a fullscreen layout(layout2) (In fullscreen mode the child-component should be in fullscreen). The problem is, when i change layout with *ngIf, the child-component is destroyed and a new one is generated. I want to have the same instance and don't loose important informations of child-component and avoid some api calls.
Is there any way to achive that the child-component will not be destroyed or is there a better way than ngIf?
I just need one instance of child-component for different layouts in a parent-component.