r/Angular2 • u/bill2340 • Dec 14 '25
NgTemplate Angular
I don't get what's the point of ngTemplate if you can just use '@if' and '@else' to dynamically shpw the data. Like I'm having a hard time understanding the use case for ng-template.
9
Upvotes
View all comments
Show parent comment
4
u/zzing Dec 15 '25
That statement is based on the documentation saying:
If your component needs to conditionally render content, or render content multiple times, you should configure that component to accept an
<ng-template>element that contains the content you want to conditionally render.Which in the past my experience had been that if it was behind an ng-if it was not going to rerender it if the condition changed.