TemplatePipe
Defined in: pipes/template.ts:22
Angular pipe that transforms template strings by replacing placeholders with provided data.
Remarks
This pipe parses the template into an Ast and evaluates it using transformAst, supports optional fallback behavior: If an error occurs during transformation and fallback is enabled, the pipe returns the last successfully transformed value instead of throwing an error. Fallback behavior may be enabled explicitly via the "fallbackOnError" parameter or globally through TemplateEngineConfig.
Since
1.1.0
Author
Simon Kovtyk
Implements
PipeTransform
Constructors
Constructor
ts
new TemplatePipe(): TemplatePipe;Returns
TemplatePipe
Methods
transform()
ts
transform(
value,
data,
fallbackOnError?): string;Defined in: pipes/template.ts:53
Transforms a template string using the provided data.
Parameters
| Parameter | Type | Description |
|---|---|---|
value | string | The template string to transform. |
data | DataRecord | DataArray | Object or array of values to replace placeholders. |
fallbackOnError? | boolean | Optional flag to return the last successful result on error. |
Returns
string
The transformed template string.
Throws
If transformation fails and no fallback value is available.
Since
1.0.0
Author
Simon Kovtyk
Implementation of
ts
PipeTransform.transform