docs(orderBy): clarify behavior of default comparator wrt null

Document how `orderBy`'s default comparator handles `null` values.

Fixes #15293

Closes #15304
This commit is contained in:
Allan Watson
2016-10-20 13:49:18 -04:00
committed by Georgios Kalpakas
parent 21ac2c42ea
commit 6a33749686
2 changed files with 7 additions and 1 deletions
+4 -1
View File
@@ -1125,7 +1125,11 @@ and "$dependentProvider" would have actually accomplished something and changed
app. This is no longer possible within a single module.
### Filters (`orderBy`)
- due to [a097aa95](https://github.com/angular/angular.js/commit/a097aa95b7c78beab6d1b7d521c25f7d9d7843d9),
`orderBy` now treats `null` values (which in JavaScript have type `object`) as having a string
represenation of `'null'`.
### Animation (`ngAnimate`)
@@ -1229,7 +1233,6 @@ or simply use:
## Migrating from 1.0 to 1.2
+3
View File
@@ -86,6 +86,9 @@
*
* **Note:** If you notice numbers not being sorted as expected, make sure they are actually being
* saved as numbers and not strings.
* **Note:** For the purpose of sorting, `null` values are treated as the string `'null'` (i.e.
* `type: 'string'`, `value: 'null'`). This may cause unexpected sort order relative to
* other values.
*
* @param {Array|ArrayLike} collection - The collection (array or array-like object) to sort.
* @param {(Function|string|Array.<Function|string>)=} expression - A predicate (or list of