Can it be supported Angular @pipe?
See original GitHub issueWhen I use in Angular @Pipe
import { Pipe, PipeTransform, Inject, LOCALE_ID } from '@angular/core';
import { DatePipe } from "@angular/common";
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
import { LayoutQuery } from '@akita/queries';
@UntilDestroy()
@Pipe({
name: 'dateSyncLocale',
pure: false
})
export class DateSyncLocalePipe extends DatePipe implements PipeTransform {
private cachedSource: any = null;
private cachedData: any = null;
constructor(
private layoutQuery: LayoutQuery,
@Inject(LOCALE_ID) locale: string
) {
super(locale);
}
transform(value: any, args?: any) {
if (value !== this.cachedSource) {
this.cachedSource = value;
this.layoutQuery.currentLanguage$
.pipe(untilDestroyed(this))
.subscribe(() =>
this.cachedData = super.transform(value, args ? args : 'yyyy/MM/dd (EEEEE) HH:mm:ss')
);
}
return this.cachedData;
}
}
I got error
Can it be supported Angular @Pipe?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Understanding Pipes - Angular
Pipes are simple functions to use in template expressions to accept an input value and return a transformed value. Pipes are useful because...
Read more >Angular Pipes: Learn How to Create and Implement
Angular supports many built-in pipes. However, you can also create custom pipes that suit your requirements. Some salient features include:.
Read more >Angular - Use pipes in services and components
Yes, it is possible by using a simple custom pipe. Advantage of using custom pipe is if we need to update the date...
Read more >A Dive Into Angular Pipes - DEV Community
An Angular pipe only supports OnDestroy lifecycle hook. You can clear out any subscription or data that you might use inside the pipe....
Read more >Built-In Pipes • Angular - codecraft.tv
Angular provides the following set of built-in pipes. CurrencyPipe. This pipe is used for formatting currencies. Its first argument is an abbreviation of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It would be nice to add it.
v7.2.0