question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can it be supported Angular @pipe?

See original GitHub issue

When 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 image Can it be supported Angular @Pipe?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
NetanelBasalcommented, May 25, 2020

It would be nice to add it.

0reactions
NetanelBasalcommented, Jun 19, 2020

v7.2.0

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found