The magic of template reference variables
summary
Shows that template reference variables using #ref syntax give direct access to the HTML element or to a component instance so templates can call methods or read properties without ngModel, documents that JIT allows access even to private/protected members while AOT can block that, explains how directives expose names via exportAs and how those names bind to form validation, and demonstrates retrieving the same references in TypeScript with @ViewChild so the examples actually run and the feature works end to end.
AI-written summary · about
chapters (10)
- 0:00Intro
- 0:18Story of this start
- 0:50Abstract Syntax
- 1:09Using Abstract Syntax
- 1:47Abstract Syntax on Components
- 2:35Syntax on Directives
- 3:26How does it work
- 3:44Source code
- 5:09Summary
- 5:40Outro
related talks
31mThe differences between ElementRef, TemplateRef, ViewContainerRef
23mngTemplateOutlet: The secret to customisation
35mUp-close with Structural Directives
33mDemystified Angular Directives
30mHow Angular works
12mTyping the not so secret to customisation ngTemplateOutlet
26mMaster Tooling by Hacking the Angular Compiler
30mReactive parenting with Angular 2
