Skip to content

Commit

Permalink
feat(danrevah#20): Add orderBy pipe
Browse files Browse the repository at this point in the history
  • Loading branch information
danrevah committed Jan 28, 2017
1 parent 8157008 commit 24d6560
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -665,24 +665,24 @@ const deepObj = [

```html
<!-- Returns array orderd by value -->
<p>{{ numbers | orderBy }}</p> <!--- Output: [1, 2, 3] --->
<p>{{ numbers | orderBy: '-' }}</p> <!--- Output: [3, 2, 1] --->
<p>{{ numbers | orderBy }}</p> <!-- Output: [1, 2, 3] -->
<p>{{ numbers | orderBy: '-' }}</p> <!-- Output: [3, 2, 1] -->

<!-- Returns array orderd by value of property -->
<p>{{ deepObj | orderBy: 'amount' }}</p>
<!--- Output: [{id: 3, ...}, {id: 4, ...}, {id: 2, ...}, {id: 1, ...}] --->
<!-- Output: [{id: 3, ...}, {id: 4, ...}, {id: 2, ...}, {id: 1, ...}] -->
<p>{{ deepObj | orderBy: '-amount' }}</p>
<!--- Output: [{id: 1, ...}, {id: 2, ...}, {id: 4, ...}, {id: 3, ...}] --->
<!-- Output: [{id: 1, ...}, {id: 2, ...}, {id: 4, ...}, {id: 3, ...}] -->

<!-- Returns array orderd by value of deep property -->
<p>{{ deepObj | orderBy: 'deep.prop' }}</p>
<!--- Output: [{id: 3, ...}, {id: 2, ...}, {id: 4, ...}, {id: 1, ...}] --->
<!-- Output: [{id: 3, ...}, {id: 2, ...}, {id: 4, ...}, {id: 1, ...}] -->
<p>{{ deepObj | orderBy: '-deep.prop' }}</p>
<!--- Output: [{id: 1, ...}, {id: 4, ...}, {id: 2, ...}, {id: 3, ...}] --->
<!-- Output: [{id: 1, ...}, {id: 4, ...}, {id: 2, ...}, {id: 3, ...}] -->

<!-- Returns array orderd by mutliple properties -->
<p>{{ obj | orderBy: ['amount', 'id'] }}</p>
<!--- Output: [{id: 1, ...}, {id: 3, ...}, {id: 2, ...}, {id: 4, ...}] --->
<!-- Output: [{id: 1, ...}, {id: 3, ...}, {id: 2, ...}, {id: 4, ...}] -->
```

## Object
Expand Down

0 comments on commit 24d6560

Please sign in to comment.