Ng template in Angular 12 and ngTemplateOutlet with context

Опубликовано: 11 Октябрь 2024
на канале: JS Frameworks
4,239
78

Angular 12 tutorial - ng template and ngTemplateOutlet explained in detail. We check out how we can use ng-template with *ngIf structural directive using multiple formats like then, else etc.
We then explore the ngTemplateOutlet directive and also the context of the template which we can set in ngTemplateOutlet. We then explore how we can use templateRef inside a component using createEmbeddedView method in ViewContainerRef. We also explore the context and other methods like clear, detach, insert available in the ViewContainerRef.

Github url - https://github.com/anuroopjoy/ngtempl...

00:00 - Introduction
00:58 - *ngIf
05:02 - ngTemplateOutlet
06:02 - ngTemplateOutlet context
08:28 - createEmbeddedView