An embedded view can be referenced from a component other than the hosting component whose template defines it, or it can be defined independently by a TemplateRef. What is the meaning of the above statement?
I couldn't understand the difference between templateRef and embeddedViewRef
TemplateRef is a basically reference to a template - a RULE for piece of html that you don't see yet, but you can build many pieces of html with it.
EmbeddedViewRef is a reference to already rendered piece of html. It could have been built with the help of some Template ref. The reason it is called "embedded" is because it is bound to its parent component change detection and in most cases also to its injector tree
<ng-template #myTpl> <!-- here is a template, and myTpl is a template ref.
no html will be rendered in this place at all,
it is like a function, that has not been called yet
-->
<div> some content </div>
</ng-template>
<div *ngTemplateOutlet="myTpl">
<!-- here we use myTpl template to create embedded view with
the help of ngTempalteOutlet directive.
This directive will have embeddedViewRef in its code and this is the place where we will have some html rendered
-->
</div>