feat: challenge 54 pipe obs signal (#903)

This commit is contained in:
Laforge Thomas
2024-06-17 20:51:27 +02:00
committed by GitHub
parent e6fd5468e2
commit d49cbc0de8
26 changed files with 417 additions and 25 deletions

View File

@@ -0,0 +1,15 @@
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}`));
}
}