@microsoft/fast-element > compileTemplate
compileTemplate() function
Compiles a template and associated directives into a raw compilation result which include a cloneable DocumentFragment and factories capable of attaching runtime behavior to nodes within the fragment.
Signature:export declare function compileTemplate(template: HTMLTemplateElement, directives: ReadonlyArray<HTMLDirective>): CompilationResult;
Parameters
Parameter | Type | Description |
---|---|---|
template | HTMLTemplateElement | The template to compile. |
directives | ReadonlyArray<HTMLDirective> | The directives referenced by the template. |
Remarks
The template that is provided for compilation is altered in-place and cannot be compiled again. If the original template must be preserved, it is recommended that you clone the original and pass the clone to this API.