This random PR taught me how to strongly type my generic Angular component @JoshuaMorony
This random PR taught me how to strongly type my generic Angular component  @JoshuaMorony
Uploaded August 2022 | Updated September 2026, 2 weeks ago
My modern Angular course: angularstart.com

In this video, we investigate how to use custom directives, TypeScript generics, and ngTemplateContextGuard to add strong typing to the ng-templates in the generic table component from the last video.

Get weekly content and tips exclusive to my newsletter: https://mobirony.ck.page/4a331b9076

Learn Angular with Ionic: ionicstart.com

Previous video (ngTemplateOutlet): youtube.com/watch?v=TZZApWysF9g
Source code (untyped): github.com/joshuamorony/ng-template-outlet-example
Source code (typed): github.com/joshuamorony/ng-template-outlet-example/tree/strongly-typed
Chau's PR: github.com/joshuamorony/ng-template-outlet-example/pull/1
Chau's YouTube: youtube.com/c/ChauTran
Chau's Twitter: twitter.com/Nartc1410

0:00 Introduction
1:26 What's wrong?
3:55 Removing magic strings
7:09 Using TypeScript Generics
13:34 Using Generics with Directives
16:37 Using ngTemplateContextGuard
21:18 Star syntax
23:03 Conclusion

#angular #typescript

- More tutorials: eliteionic.com
- Follow me on Twitter: twitter.com/joshuamorony
This random PR taught me how to strongly type my generic Angular componentAngular without selectors is (probably) comingA dumber way to approach loading templates in AngularCan you do INFINITE scroll reactively in Angular? (no manual subscribes)Angular is finally a serious contender for content driven sites (with Analog)How Nx made me even *more* productiveThe CLEANEST authentication Ive ever built with AngularWhy component store is a great default for state management in AngularWhat I learned about AI coding from 1 YEAR of game dev (as a frontend engineer)RxJS operators and their dangerous consequencesThe first time AI has made me feel 10x more productiveWhy I finally decided to use Single File Components in Angular
Joshua Morony |

This random PR taught me how to strongly type my generic Angular component

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER