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

Commit 9399d68

Browse files
gkalpakpetebacondarwin
authored andcommitted
docs(*): document the breaking change introduced in e1da4be (#15434)
Closes #15434
1 parent 4a320ab commit 9399d68

File tree

2 files changed

+69
-3
lines changed

2 files changed

+69
-3
lines changed

CHANGELOG.md

+36-3
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ ensure that Angular 1 can pass the linter checks for Mozilla add-ons.
8686

8787
- **ngModelOptions:** allow options to be inherited from ancestor `ngModelOptions` ([296cfc](https://github.com/angular/angular.js/commit/296cfce40c25e9438bfa46a0eb27240707a10ffa) [#10922](https://github.com/angular/angular.js/issues/10922))
8888
- **$compile:** set `preAssignBindingsEnabled` to false by default ([bcd0d4](https://github.com/angular/angular.js/commit/bcd0d4d896d0dfdd988ff4f849c1d40366125858) [#15352](https://github.com/angular/angular.js/issues/15352))
89-
- **input[type=number]:** support `step` ([e1da4bed8](https://github.com/angular/angular.js/commit/e1da4bed8e291003d485a8ad346ab80bed8ae2e3) [#10597](https://github.com/angular/angular.js/issues/10597))
89+
9090

9191
## Bug Fixes
9292

@@ -270,12 +270,14 @@ Please read the [Sandbox Removal Blog Post](http://angularjs.blogspot.com/2016/0
270270
- JSONP callback must be specified by `jsonpCallbackParam` config ([fb6634](https://github.com/angular/angular.js/commit/fb663418710736161a6b5da49c345e92edf58dcb) [#15161](https://github.com/angular/angular.js/issues/15161) [#11352](https://github.com/angular/angular.js/issues/11352))
271271
- JSONP requests now require a trusted resource URL ([6476af](https://github.com/angular/angular.js/commit/6476af83cd0418c84e034a955b12a842794385c4) [#11352](https://github.com/angular/angular.js/issues/11352))
272272
- **ngModelOptions:** allow options to be inherited from ancestor `ngModelOptions` ([87a2ff](https://github.com/angular/angular.js/commit/87a2ff76af5d0a9268d8eb84db5755077d27c84c) [#10922](https://github.com/angular/angular.js/issues/10922))
273-
- **input:** add support for binding to `input[type=range]` ([913016](https://github.com/angular/angular.js/commit/9130166767c4792c5d32d08a918fc7becf32c9a6) [#5892](https://github.com/angular/angular.js/issues/5892) [#14870](https://github.com/angular/angular.js/issues/14870))
273+
- **input:**
274+
- add support for binding to `input[type=range]` ([913016](https://github.com/angular/angular.js/commit/9130166767c4792c5d32d08a918fc7becf32c9a6) [#5892](https://github.com/angular/angular.js/issues/5892) [#14870](https://github.com/angular/angular.js/issues/14870))
275+
- add support for `step` to `input[type=number]` ([e1da4be](https://github.com/angular/angular.js/commit/e1da4bed8e291003d485a8ad346ab80bed8ae2e3) [#10597](https://github.com/angular/angular.js/issues/10597))
276+
- allow `ngTrim` to work for `input[type=radio]` ([47724b](https://github.com/angular/angular.js/commit/47724baffe050269385b3481e9a9cf4ab3944b4b))
274277
- **ngRoute:** allow `ngView` to be included in an asynchronously loaded template ([c13c66](https://github.com/angular/angular.js/commit/c13c666728c1a1485ef18e92d7cb35118ce39609) [#1213](https://github.com/angular/angular.js/issues/1213))
275278
- **select:** support values of any type added with `ngValue` ([f02b70](https://github.com/angular/angular.js/commit/f02b707b5e4a5ffd1e1a20d910754cfabfc19622) [#9842](https://github.com/angular/angular.js/issues/9842))
276279
- **$interpolate:** use custom `toString()` function if present ([a5fd2e](https://github.com/angular/angular.js/commit/a5fd2e4c0376676fa317e09a8d8be4966b82cbfe) [#7317](https://github.com/angular/angular.js/issues/7317) [#11406](https://github.com/angular/angular.js/issues/11406))
277280
- **$route:** implement `resolveRedirectTo` ([e98656](https://github.com/angular/angular.js/commit/e9865654b39c71be71034c38581a8c7bd16bc716) [#5150](https://github.com/angular/angular.js/issues/5150))
278-
- **input[type=radio]:** allow `ngTrim` to work for `input[type=radio]` ([47724b](https://github.com/angular/angular.js/commit/47724baffe050269385b3481e9a9cf4ab3944b4b))
279281
- **$q:** report promises with non rejection callback ([c9dffd](https://github.com/angular/angular.js/commit/c9dffde1cb167660120753181cb6d01dc1d1b3d0) [#13653](https://github.com/angular/angular.js/issues/13653) [#7992](https://github.com/angular/angular.js/issues/7992))
280282
- **$location:** default hashPrefix to `'!'` ([aa077e](https://github.com/angular/angular.js/commit/aa077e81129c740041438688dff2e8d20c3d7b52) [#13812](https://github.com/angular/angular.js/issues/13812))
281283

@@ -1286,6 +1288,37 @@ to a valid value, the input will in turn set the model to this new valid value v
12861288
- browsers that do not support `input[type=range]` (IE9) handle the input like a number input (with validation etc.)
12871289

12881290

1291+
### `input[type=number]` due to:
1292+
1293+
- **[e1da4be](https://github.com/angular/angular.js/commit/e1da4bed8e291003d485a8ad346ab80bed8ae2e3)**: add support for `step` to `input[type=number]`
1294+
1295+
Number inputs that use `ngModel` and specify a `step` constraint (via `step`/`ngStep` attributes)
1296+
will now have a new validator (`step`), which will verify that the current value is valid under the
1297+
`step` constraint (according to the [spec](https://www.w3.org/TR/html5/forms.html#the-step-attribute)).
1298+
Previously, the `step` constraint was ignored by `ngModel`, treating values as valid even when there
1299+
was a step-mismatch.
1300+
1301+
If you want to restore the previous behavior (use the `step` attribute while disabling step
1302+
validation), you can overwrite the built-in `step` validator with a custom directive. For example:
1303+
1304+
```js
1305+
// For all `input` elements...
1306+
.directive('input', function() {
1307+
return {
1308+
restrict: 'E',
1309+
require: '?ngModel',
1310+
link: function (scope, elem, attrs, ngModelCtrl) {
1311+
// ...that are of type "number" and have `ngModel`...
1312+
if ((attrs.type === 'number') && ngModelCtrl) {
1313+
// ...remove the `step` validator.
1314+
delete ngModelCtrl.$validators.step;
1315+
}
1316+
}
1317+
};
1318+
})
1319+
```
1320+
1321+
12891322

12901323
<a name="1.4.13"></a>
12911324
# 1.4.13 croaking-elderweed (2016-10-10)

docs/content/guide/migration.ngdoc

+33
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ Below is the full list of breaking changes:
114114
- Core:
115115
- [Directives](guide/migration#migrate1.5to1.6-ng-directives)
116116
- [form](guide/migration#migrate1.5to1.6-ng-directives-form)
117+
- [input[number]](guide/migration#migrate1.5to1.6-ng-directives-input[number])
117118
- [input[radio]](guide/migration#migrate1.5to1.6-ng-directives-input[radio])
118119
- [input[range]](guide/migration#migrate1.5to1.6-ng-directives-input[range])
119120
- [ngBind](guide/migration#migrate1.5to1.6-ng-directives-ngBind)
@@ -166,6 +167,38 @@ $scope.$watch('something', function() {
166167
or you can use `Function.prototype.bind` or `angular.bind`.
167168

168169

170+
<a name="migrate1.5to1.6-ng-directives-input[number]"></a>
171+
#### **input[type=number]**:
172+
173+
<minor />
174+
**Due to [e1da4be](https://github.com/angular/angular.js/commit/e1da4bed8e291003d485a8ad346ab80bed8ae2e3)**,
175+
number inputs that use `ngModel` and specify a `step` constraint (via `step`/`ngStep` attributes)
176+
will now have a new validator (`step`), which will verify that the current value is valid under the
177+
`step` constraint (according to the [spec](https://www.w3.org/TR/html5/forms.html#the-step-attribute)).
178+
Previously, the `step` constraint was ignored by `ngModel`, treating values as valid even when there
179+
was a step-mismatch.
180+
181+
If you want to restore the previous behavior (use the `step` attribute while disabling step
182+
validation), you can overwrite the built-in `step` validator with a custom directive. For example:
183+
184+
```js
185+
// For all `input` elements...
186+
.directive('input', function() {
187+
return {
188+
restrict: 'E',
189+
require: '?ngModel',
190+
link: function (scope, elem, attrs, ngModelCtrl) {
191+
// ...that are of type "number" and have `ngModel`...
192+
if ((attrs.type === 'number') && ngModelCtrl) {
193+
// ...remove the `step` validator.
194+
delete ngModelCtrl.$validators.step;
195+
}
196+
}
197+
};
198+
})
199+
```
200+
201+
169202
<a name="migrate1.5to1.6-ng-directives-input[radio]"></a>
170203
#### **input[type=radio]**:
171204

0 commit comments

Comments
 (0)