Typing the not so secret to customisation ngTemplateOutlet
summary
Shows how to get real typing for ngTemplateOutlets by replacing label markers with a directive to tag templates plus an ngTemplate context guard that asserts the template’s context interface. Demonstrates making the directive generic, adding an input so Angular infers the generic from usage, and how Angular 16 tightens context checking. Uses a concrete sharks example and points to a repo with runnable code and comparison of structural and attribute syntaxes.
AI-written summary · about
chapters (8)
- 0:00Introduction
- 1:24What is ngTemplateOutlet
- 4:15Typing problem
- 5:19Introducing ngTemplateContextGuard
- 7:28Using ngTemplateContextGuard
- 8:09Generic types with ngTemplateOutlet
- 10:58Alternative syntax
- 11:41Angular 16 context typing
related talks
23mngTemplateOutlet: The secret to customisation
26mMaster Tooling by Hacking the Angular Compiler
06mThe magic of template reference variables
31mGetting to Know the Template Type Checker
35mUp-close with Structural Directives
30mHacking the Angular compiler with your own syntax
17mContextual Template States with Angular
33mDemystified Angular Directives
