ngIfdirective conditionally adds or removes content from the DOM based on whether or not an expression is true or false.
ngIfdirective to an example component.
IfExampleComponentis a part of the DOM, as opposed to just whether it is visible or not. This means that every time the button is clicked,
IfExampleComponentwill be created or destroyed. This can be an issue with components that have expensive create/destroy actions. For example, a component could have a large child subtree or make several HTTP calls when constructed. In these cases it may be better to avoid using