Skip to content

Commit

Permalink
docs: add guidance on adding filtering and sorting logic to componetn…
Browse files Browse the repository at this point in the history
…s instead of pipes (#42368)

Fixes #41652

PR Close #42368
  • Loading branch information
David Shevitz authored and thePunderWoman committed Jun 9, 2021
1 parent e1a80d4 commit 3de774e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions aio/content/guide/styleguide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2759,6 +2759,30 @@ A typical *lazy loaded folder* contains a *routing component*, its child compone

<a href="#toc">Back to top</a>

### Do not add filtering and sorting logic to pipes

#### Style 04-13

<div class="s-rule avoid">

**Avoid** adding filtering or sorting logic into custom pipes.

</div>

<div class="s-rule do">

**Do** pre-compute the filtering and sorting logic in components or services before binding the model in templates.

</div>

<div class="s-why-last">

**Why?** Filtering and especially sorting are expensive operations. As Angular can call pipe methods many times per second, sorting and filtering operations can degrade the user experience severely for even moderately-sized lists.

</div>

<a href="#toc">Back to top</a>

## Components

{@a 05-03}
Expand Down

0 comments on commit 3de774e

Please sign in to comment.