Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit b9e5eaf

Browse files
SteveShafferlgalfaso
authored andcommitted
docs(select): Updated ngOptions track by examples
Made the example shown consistent with the advice above it regarding not using `select as` and `track by` in the same comprehension expression. Also changed references to `trackexpr` to `track by` since `trackexpr` is not defined except in the examples. Added filter + track by example for ngOptions The documentation for ngRepeat includes such an example specifying the proper order for filters and and "track by" clauses in the comprehension expression, but these docs for ngOptions do not.
1 parent 228281e commit b9e5eaf

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/ng/directive/select.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ var ngOptionsMinErr = minErr('ngOptions');
4242
* or property name (for object data sources) of the value within the collection. If a `track by` expression
4343
* is used, the result of that expression will be set as the value of the `option` and `select` elements.
4444
*
45-
* ### `select as` with `trackexpr`
45+
* ### `select as` with `track by`
4646
*
47-
* Using `select as` together with `trackexpr` is not recommended. Reasoning:
47+
* Using `select as` together with `track by` is not recommended. Reasoning:
4848
*
4949
* - Example: <select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected">
5050
* values: [{id: 1, label: 'aLabel', subItem: {name: 'aSubItem'}}, {id: 2, label: 'bLabel', subItem: {name: 'bSubItem'}}],
@@ -69,8 +69,10 @@ var ngOptionsMinErr = minErr('ngOptions');
6969
* * for array data sources:
7070
* * `label` **`for`** `value` **`in`** `array`
7171
* * `select` **`as`** `label` **`for`** `value` **`in`** `array`
72-
* * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
73-
* * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
72+
* * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
73+
* * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
74+
* * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`
75+
* (for including a filter with `track by`)
7476
* * for object data sources:
7577
* * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
7678
* * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`

0 commit comments

Comments
 (0)