Questions tagged [angular2-custom-pipes]

31 questions
11
votes
1 answer

Angular custom pipe not be found

In my application I need a custom pipe globally, I try to implement it following angular pipe but i see always this error Template parse errors: The pipe 'formatdate' could not be found formatdate.pipe import { Pipe, PipeTransform } from…
Alessandro Celeghin
  • 4,039
  • 14
  • 49
  • 95
4
votes
1 answer

Angular 2 - How to use build-in pipe inside custom pipe

I want to make a custom currency pipe using the built-in currency pipe. The way I want to use is {{ anyNumber | customCurrency }}. Then inside my customCurrency pipe, I want to use built-in currency pipe. I can decide the parameters to currency pipe…
Vijay Malik
  • 107
  • 1
  • 1
  • 10
2
votes
3 answers

Angular6 Getting error while trying to using DecimalPipe to a custom pipe

I am trying to inject DecimalPipe to my custom pipe as described in this answer. here is the code: @Pipe({name: 'irc'}) export class IRCurrencyPipe implements PipeTransform { constructor(private decimalPipe: DecimalPipe) {} transform(value:…
Mr Alihoseiny
  • 1,202
  • 14
  • 24
2
votes
1 answer

Where does a custom pipe instance live? How can the component code access the custom pipe instance used in its HTML?

I have a custom pipe I use in the HTML part of a component. It is declared in the module: declarations: [ I18nPipe ], I want to be able to call a method on it from the component code (not the transform method). I was hoping that the pipe…
Dacian
  • 678
  • 6
  • 12
2
votes
1 answer

Angular 2 Custom pipe filer issue

I want to filter data according to men and women with custom pipe in employeemale.ts component when I use female in custom pipe in ngfor loop it shows data according to female: Works:
Nitesh
  • 35
  • 3
2
votes
2 answers

Custom Pipe | filter for calculating relative time in angular2

During the learning process, I came across Creation of Custom Pipe, so I thought this will help.
Aravind
  • 40,391
  • 16
  • 91
  • 110
1
vote
2 answers

Angular - transform innerHtml using two pipes

Used two pipes to make an html markup, from my database, safer and shorter: @Pipe({ name: 'safe' }) export class SafePipe implements PipeTransform { constructor(protected sanitizer: DomSanitizer) {} public transform(value: any, type:…
Sami-L
  • 5,553
  • 18
  • 59
  • 87
1
vote
0 answers

Conditionally apply Angular pipe on ngFor

I have the following code: {{user.name}} {{user.surname}} {{user.age}} {{user.email}} {{user.username}} {{user.registrationDate}} I…
smartmouse
  • 13,912
  • 34
  • 100
  • 166
1
vote
0 answers

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. …
angie
  • 13
  • 1
  • 7
1
vote
2 answers

Custom sorting pipe for Angular 6

I am trying to sort my data in the ngFor loop , but my custom pipe doesnot work as intened , can anybody help me out... export class OrderbyLastMessagePipe implements PipeTransform { transform(array: Array, args?: any): Array
Ankit Prajapati
  • 417
  • 1
  • 8
  • 20
1
vote
1 answer

Angular: Rules on when to make something a custom pipe vs component

Any rules on when to use a custom pipe and when to use a custom component? Could those be the rules of thumb (below) ? use a component if non-plaintext html is required? Inspired by: https://stackoverflow.com/a/34504446/170451 use pipe if something…
1
vote
2 answers

Bind component variable to pipe filter

i have a problem when passing values to my pipe filter. I need to pass an argument value in the form of a variable called pagex from my component and I cant find the syntax to make it work... or I'm missing something. Thanks for the…
Battalgazi
  • 367
  • 1
  • 4
  • 20
0
votes
1 answer

How to create Custom Pipe reacting on Lang change like Translate Pipe? Some sort of Impiure resticted pipe?

I'm trying to modify a custom pipe to react when language changes. here is my custom pipe, which validate and transform date into correct format import { ChangeDetectorRef, Pipe, PipeTransform } from '@angular/core'; import { TranslatePipe,…
0
votes
2 answers

How to specify which pipe to use if multiple modules exported same name pipes?

In my project, I'm using NgxExtendedPdfViewerModule & TranslateModule(@ngx-translate/core). Both packages export translate pipe. The translate pipe from NgxExtendedPdfViewerModule returns Promise. And, the translate pipe from TranslateModule…
1
2 3