Author: Thomas Laforge
Angular offer the static function ngTemplateContextGuard to strongly type structural directive.
However the context of NgTemplateOutlet type is Object. But which the help of the above guard, we can improve that behavior.
In this exercice, we want to learn how to strongly typed our ng-template in our AppComponent.
This exercice has two level of complexity.
Currently we have the following piece of code.
As we can see, name is of type "any". We want to infer the correct type.
Currently we have the following piece of code.
As we can see, student is of type "any". We want to infer the correct type.
But in this part, we can pass to ListComponent, a list of any object. And we still want the correct type to be infered.
- Fork the project
- clone it
- npm ci
- nx serve context-outlet-type
- ...work On it
- Commit your work
- Submit a PR with a title beginning with Answer:4 that I will review and other dev can review.