Skip to content

Commit f9e6db9

Browse files
langxyzxyzAndrewKushnir
authored andcommitted
docs: use arrays in the impure pipe example (angular#59196)
PR Close angular#59196
1 parent cf27cbb commit f9e6db9

File tree

1 file changed

+4
-10
lines changed
  • adev/src/content/guide/templates

1 file changed

+4
-10
lines changed

adev/src/content/guide/templates/pipes.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -277,18 +277,12 @@ Avoid creating impure pipes unless absolutely necessary, as they can incur a sig
277277
import { Pipe, PipeTransform } from '@angular/core';
278278
279279
@Pipe({
280-
name: 'featuredItemsImpure',
280+
name: 'joinNamesImpure',
281281
pure: false,
282282
})
283-
export class FeaturedItemsImpurePipe implements PipeTransform {
284-
transform(value: string, format: string): string {
285-
let msg = `My custom transformation of ${value}.`
286-
287-
if (format === 'uppercase') {
288-
return msg.toUpperCase()
289-
else {
290-
return msg
291-
}
283+
export class JoinNamesImpurePipe implements PipeTransform {
284+
transform(names: string[]): string {
285+
return names.join();
292286
}
293287
}
294288
```

0 commit comments

Comments
 (0)