@@ -178,8 +178,8 @@ have been fixed. The breaking changes are comparatively minor and should not aff
178
178
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
179
179
when `ngOptions` renders the option values within the DOM, the resulting HTML code is different.
180
180
Normally this should not affect your application at all, however, if your code relies on inspecting
181
- the value property of `<option>` elements (that `ngOptions` generates) then be sure to [read the details]
182
- (https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef).
181
+ the value property of `<option>` elements (that `ngOptions` generates) then be sure
182
+ to [read the details] (https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef).
183
183
184
184
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
185
185
when iterating over an object's properties using the `(key, value) in obj` syntax
@@ -205,9 +205,19 @@ In Angular 1.3.x, setting `scope.x = 200` would select the option with the value
205
205
</select>
206
206
```
207
207
208
- In Angular 1.4.x, the 'unknown option' will be selected. To remedy this, you can either initialize
209
- the model as a string - `scope.x = '200'` - or implement a parser on `ngModel` that converts
210
- the option string value to a `Number`.
208
+ In Angular 1.4.x, the 'unknown option' will be selected.
209
+ To remedy this, you can simply initialize the model as a string: `scope.x = '200'`, or if you want to
210
+ keep the model as a `Number`, you can do the conversion via `$formatters` and `$parsers` on `ngModel`:
211
+
212
+ ```js
213
+ ngModelCtrl.$parsers.push(function(value) {
214
+ return parseInt(value, 10); // Convert option value to number
215
+ });
216
+
217
+ ngModelCtrl.$formatters.push(function(value) {
218
+ return value.toString(); // Convert scope value to string
219
+ });
220
+ ```
211
221
212
222
## Templating (`ngRepeat`, `$compile`)
213
223
0 commit comments