From ae7758a5143e1da6a3bfb5c06036f41352f16df2 Mon Sep 17 00:00:00 2001 From: Steve Shaffer Date: Tue, 25 Nov 2014 17:23:31 -0800 Subject: [PATCH 1/2] 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. --- src/ng/directive/select.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index df2359d12294..7c3d8d25febd 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -42,9 +42,9 @@ var ngOptionsMinErr = minErr('ngOptions'); * or property name (for object data sources) of the value within the collection. If a `track by` expression * is used, the result of that expression will be set as the value of the `option` and `select` elements. * - * ### `select as` with `trackexpr` + * ### `select as` with `track by` * - * Using `select as` together with `trackexpr` is not recommended. Reasoning: + * Using `select as` together with `track by` is not recommended. Reasoning: * * - Example: <select ng-options="item.subItem as item.label for item in values track by item.id" ng-model="selected"> * values: [{id: 1, label: 'aLabel', subItem: {name: 'aSubItem'}}, {id: 2, label: 'bLabel', subItem: {name: 'bSubItem'}}], @@ -70,7 +70,7 @@ var ngOptionsMinErr = minErr('ngOptions'); * * `label` **`for`** `value` **`in`** `array` * * `select` **`as`** `label` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` - * * `select` **`as`** `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr` + * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr` * * for object data sources: * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object` From cde7e40753bb5543f16b9ba0d0787f5aeb596165 Mon Sep 17 00:00:00 2001 From: Steve Shaffer Date: Wed, 26 Nov 2014 07:30:08 -0800 Subject: [PATCH 2/2] 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. --- src/ng/directive/select.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ng/directive/select.js b/src/ng/directive/select.js index 7c3d8d25febd..78b666239e7d 100644 --- a/src/ng/directive/select.js +++ b/src/ng/directive/select.js @@ -71,6 +71,8 @@ var ngOptionsMinErr = minErr('ngOptions'); * * `select` **`as`** `label` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr` + * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr` + * (for including a filter with `track by`) * * for object data sources: * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object` * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`