mirror of
https://github.com/Raghu-Ch/angular-challenges.git
synced 2026-02-10 12:53:03 -05:00
16 lines
435 B
TypeScript
16 lines
435 B
TypeScript
import { inject, Pipe, PipeTransform } from '@angular/core';
|
|
import { map, Observable } from 'rxjs';
|
|
import { CurrencyService } from './currency.service';
|
|
|
|
@Pipe({
|
|
name: 'currency',
|
|
standalone: true,
|
|
})
|
|
export class CurrencyPipe implements PipeTransform {
|
|
currencyService = inject(CurrencyService);
|
|
|
|
transform(price: number): Observable<string> {
|
|
return this.currencyService.symbol$.pipe(map((s) => `${price}${s}`));
|
|
}
|
|
}
|