ng2 - Difference between ng-container and ng-template tags

前端 未结 7 972
温柔的废话
温柔的废话 2020-12-01 00:15

Can someone please illustrate the difference between using and elements?

I could not find document

相关标签:
7条回答
  • 2020-12-01 01:13

    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

    0 讨论(0)
提交回复
热议问题