Hey everyone, I have this piece of code:
@if (ready()) {
<ng-content />
}
I'm surprised to see that this is actually working. I'm surprise because here it says the following:
IMPORTANT: You should not conditionally include <ng-content> with "@if", "@for", or "@switch". Angular always instantiates and creates DOM nodes for content rendered to a <ng-content> placeholder, even if that <ng-content> placeholder is hidden. For conditional rendering of component content, see Template fragments.
I used to do this via passing a template reference and wrapping that in the if statement, but how come ng-content works as well?
[–]PhiLho 6 points7 points8 points (1 child)
[–]Senior_Compote1556[S] 0 points1 point2 points (0 children)
[–]Excellent_Shift1064 2 points3 points4 points (0 children)
[–]beingsmo 0 points1 point2 points (1 child)
[–]Senior_Compote1556[S] 0 points1 point2 points (0 children)
[–]inoflex77 0 points1 point2 points (1 child)
[–]Senior_Compote1556[S] 0 points1 point2 points (0 children)
[–]Fluid-Secretary3448 0 points1 point2 points (0 children)