From my understanding of docs and few sample code, I realize that ViewContainer is something that holds a templateRef, while templateRef in itself holds the HTML. But I would like to know a further explanation:
I have questions like :
What each one of them exactly does.
How often do we find each one of them in a layout. Is each of them associated with every single node on my HTML.
Thanks in advance
Template Ref ViewContainerRef
-----------------------------------------------------------------------------------
Represents an Embedded Template It is a continaer in which templates in
which one or more Views can be attached
Used for creating a custom structural Wrapper for holding the view
directive created using TemplateRef
Two ways to access Can attach views in 2 ways
- using * infront - using createComponent()
- using as a property binding - using createEmbeddedView()
To answer your second question,
ngIf, ngSwitch, ngFor are creating using these classes.