diff --git a/src/ng/directive/ngOptions.js b/src/ng/directive/ngOptions.js index 282dff3aedd2..2cc8a353edca 100644 --- a/src/ng/directive/ngOptions.js +++ b/src/ng/directive/ngOptions.js @@ -58,29 +58,28 @@ var ngOptionsMinErr = minErr('ngOptions'); * ### `select` **`as`** and **`track by`** * *
- * Do not use `select` **`as`** and **`track by`** in the same expression. They are not designed to work together. + * Be careful when using `select` **`as`** and **`track by`** in the same expression. *
* - * Consider the following example: + * This will work: * * ```html - * + * * ``` * - * ```js - * $scope.values = [{ - * id: 1, - * label: 'aLabel', - * subItem: { name: 'aSubItem' } - * }, { - * id: 2, - * label: 'bLabel', - * subItem: { name: 'bSubItem' } - * }]; + * This will not work: * - * $scope.selected = { name: 'aSubItem' }; + * ```html + * * ``` * + * In both examples the **`track by`** expression is applied sucessfully to each `item` in `items`. It is also + * applied to the selected value from `ngModel`. In the first example this will be `item`. However, in the + * second example, the selected value will be `item.value` causing the **`track by`** expression to evaluate + * `item.value.id`. As a result, the selected element is never found and the `