ApplyMiddlewarePipe
Methods
transform()
This method applies a middleware method to the given value.
Parameters:
value
— The data to apply the middleware to. It is of typeParameters<M>
, whereM
is the type of the middleware method to use.method
— The name of the middleware method to use. It is of typeK
, whereK
is the key of the middleware method to use.
Returns:
- The result of the middleware method, of type
ReturnType<M>
, whereM
is the type of the middleware method to use.
Usage
Here’s an example:
In this example, the blocks
array will be processed by the blocksList
middleware function before being displayed in the template.
The ApplyMiddlewarePipe
can be used with any type of data that can be processed by the middleware functions provided by the AIPEmailBuilderMiddlewareService
. These functions can be used to transform, filter, or modify data before it is displayed in the template.
{% hint style=“info” %}
Note: It is important to note that the ApplyMiddlewarePipe
does not modify the original data; it only returns a new, processed version of the data. This means that you can use the ApplyMiddlewarePipe
multiple times in your template without affecting the original data.
{% endhint %}