packages/components/directives/eui-template.directive.ts
Directive for defining named template references that can be dynamically rendered. Provides a way to identify and retrieve templates by name for content projection. Commonly used in components that accept multiple template slots (headers, footers, custom content). Works with TemplateRef to enable flexible content customization.
Example :<ng-template euiTemplate="header">
<h2>Custom Header</h2>
</ng-template>
<ng-template euiTemplate="footer">
<button>Custom Action</button>
</ng-template>In component:
Example :@ContentChildren(EuiTemplateDirective) templates: QueryList<EuiTemplateDirective>;
getTemplate(name: string) {
return this.templates.find(t => t.getType() === name)?.template;
}| Selector | [euiTemplate] |
Properties |
Methods |
Inputs |
| euiTemplate |
Type : string
|
| type |
Type : string
|
| getType |
getType()
|
|
Returns :
string
|
| template |
Type : unknown
|
Default value : inject<TemplateRef<T>>(TemplateRef)
|