ApplyMiddlewarePipe
The ApplyMiddlewarePipe is an Email Builder pipe that allows you to apply middleware functions to data right in your component's HTML.
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.
Here's an example:
<!-- Apply the "blocksList" middleware function to the "blocks" array -->
<div *ngFor="let block of blocks | applyMiddleware:'blocksList'">
{{ block.name }}
</div>
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.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.