Strongly typed TemplateRef

Viewed 579

Angular documentation says TemplateRef requires type argument. It works by adding any, but is it possible to type it more closely?

Parent component:

<div [summaryTemplate]="summaryTemplateRef”></div>

<ng-template #summaryTemplateRef let-total="total" let-limit="limit">
  <div>
    Total items: {{ total }}
  </div>
  <div>
    page: {{ limit }}
  </div>
</ng-template>

Child component:

@Input() summaryTemplate: TemplateRef<any>;
<ng-container
  [ngTemplateOutlet]="summaryTemplate"
  [ngTemplateOutletContext]="{ total: data.length, limit: limit }">
</ng-container>
0 Answers
Related