docs: use arrays in the impure pipe example (#59196)

PR Close #59196
This commit is contained in:
Lang
2024-12-14 22:06:37 +01:00
committed by Andrew Kushnir
parent cf27cbb1f8
commit f9e6db94ec
+4 -10
View File
@@ -277,18 +277,12 @@ Avoid creating impure pipes unless absolutely necessary, as they can incur a sig
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({
name: 'featuredItemsImpure',
name: 'joinNamesImpure',
pure: false,
})
export class FeaturedItemsImpurePipe implements PipeTransform {
transform(value: string, format: string): string {
let msg = `My custom transformation of ${value}.`
if (format === 'uppercase') {
return msg.toUpperCase()
else {
return msg
}
export class JoinNamesImpurePipe implements PipeTransform {
transform(names: string[]): string {
return names.join();
}
}
```