I've created three custom pipe to order data from server (ASC, DESC and Default), they work perfectly, I want that this three pipes active or not depending of the interaction of the user.
The question is, It's posible change the custom pipe with a variable for example?.
This is my code...
<label *ngFor="let user of users | {{pipeOrderType}}:'name'">{{user.id}}{{user.name}}, </label>
There is no way to assign different pipes dynamically. You can create a pipe that behaves differently depending on a parameter
Where the pipe can be used like
while here
pipe
is a reference to an actual instance of the pipe class, not a string. You can inject pipes to your component likeYou can also inject the pipes to the
dynamicPipe
and then use it with a pipe name
Where
pipe
is'pipe1'
or'pipe2'