Can someone please illustrate the difference between using
and
elements?
I could not find document
ng-template
as the name implies, denotes a template. By itself it doesn't render anything. We can use a ng-container
to provide a placeholder to render a template dynamically.
Another use-case for ng-template
is that we can use it to nest multiple structural directives together.
You can find great examples here in this blog post: angular ng-template/ng-container