Angular · Middle · Question 58 of 75
How do you render the same template fragment in several places of a component?
<ng-template #price let-value>{{ value | currency }}</ng-template>
<ng-container *ngTemplateOutlet="price; context: { $implicit: total }" />- ✓Correct answer: Define it with
<ng-template>and render it withngTemplateOutlet - 2Copy the markup
- 3Create a separate component for every fragment
Explanation
A template can also be passed as an input to a child, which lets the parent customize how items are rendered.