1
votes

I have a parent component that calls in child component. I want an ngIf check to show/build or hide/don't build child component... no matter what the component is built even when not displayed (not in dom). Is there another way to stop this from happening?

Parent HTML Template:

<div>
  <child-comp *ngIf="1 == 0"></child-comp>
</div>

I am thinking that ngIf won't get me where I want to be.

1
I didn't get your question, the above code doesn't add your component to dom, it will show as comments if you take a loot at source - Reza
@RezaRahmati When I run the above the ts file for the child-comp gets ran still - even though the ngif stops it from being produced. - RooksStrife

1 Answers

1
votes

Put your ngIf check in the outer div around your child-comp