Questions tagged angular2-custom-pipes

Explore the latest questions and answers asked by our top developers.

SortPipe passing parameter

import { Pipe, PipeTransform } from ‘@angular/core’; import { courses } from ‘../interface/courses’; @Pipe({ name: ‘sort’ }) export class SortPipe implements PipeTransform { transform(value: Array<courses>, args: any[]): Array<courses> { const sortField = args[0]; const sortDirection = args[1]; let multiplier = 1; if (sortDirection === ‘desc’) { multiplier = -1; } value.sort((a: any, b: any) => […]

Angular Custom Pipe : SafeValue must use [property]=binding

This is my CustomPipe Code : Here , text is a big chunk of string. And searchColl is the collection of words which needs to be highlighted in it. This is working well and highlighting all the words in the text BUT it appends "SafeValue must use [property]=binding" on the rendered text like this : […]

Conditionally apply Angular pipe on ngFor

I have the following code: <tr *ngFor="let user of users"> <td>{{user.name}}</td> <td>{{user.surname}}</td> <td>{{user.age}}</td> <td>{{user.email}}</td> <td>{{user.username}}</td> <td>{{user.registrationDate}}</td> </tr> I need to apply a custom pipe to filter users that are not active. <tr *ngFor="let user of users | filterBy: ‘active’"> It works. But I want to have pipe being applied conditionally, only if users click on […]

sorting custom pipe in angular with Up/down img and by default Res List(-) with img (-) arrow

I would like to implement img with for sorting table by all the field via custom pipe. It work properly if I only Asc and Desc pipe but when I’m added the (-) for without sorting it not work properly. by default get the API response with button image dash but when i change it […]

angular filter add apply button

Currently, I have a Gender and Impact filter to the table which is able to filter the data on option selected. For e.g. If you will select Male it will filter male data and the same for female, impact: applicable and not applicable. Now, I wanted to add an apply button that will join both […]

How can I add apply button to filter in angular?

Currently, I have a Gender and Impact filter to the table which is able to filter the data on option selected. For e.g. If you will select Male it will filter male data and the same for female, impact: applicable and not applicable. Now, I wanted to add an apply button that will join both […]

Angular: conditional custom pipe in div ngIf*

Is there a way to conditional process an observable data through a custom pipe in an ngIf I can do something like <div *ngIf="dataFields$ | async | customPipe as fields "> However, I want to have a condition before using customPipe <div *ngIf="dataFields$ | async | <condition> ? customPipe as fields"> I only have if […]

How to pass a JSON object returned from service in HTML as a parameter to pipe in angular

I have the below code in my HTML. currencyCustomFormat is a custom Pipe. Now in this custom pipe file, i would like to access the E_CURRENCY value ( value could be AUD or NZD or any other currency fetched from service) . How can i access this. @Pipe({ name: ‘currency’ }) export class CurrencyPipe implements […]

By angie
Published
Categorized as angular, angular2-custom-pipes, pipe

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq