According to the Angular documentation on ngIf, animations occur just after the contents change and a new DOM element is created and injected into the ngIf container.
Animations
In my experience, I have encountered issues with this behavior. To demonstrate, I created a plunker showing that changing the content does not trigger the enter animation as expected. Interestingly, setting the content to
undefined
and using a 1ms$timeout
for initialization seems to resolve the issue.
My question is: Why doesn't simply changing the content trigger the enter and leave animations as outlined in the documentation?