|
| 1 | +<a name="1.3.19"></a> |
| 2 | +# 1.3.19 glutinous-shriek (2015-09-15) |
| 3 | + |
| 4 | +## Bug Fixes |
| 5 | + |
| 6 | +- **$http:** propagate status -1 for timed out requests |
| 7 | + ([f13055a0](https://github.com/angular/angular.js/commit/f13055a0a53a39b160448713a5617edee6042801), |
| 8 | + [#4491](https://github.com/angular/angular.js/issues/4491), [#8756](https://github.com/angular/angular.js/issues/8756)) |
| 9 | +- **$location:** don't crash if navigating outside the app base |
| 10 | + ([623ce1ad](https://github.com/angular/angular.js/commit/623ce1ad2cf68024719c5cae5d682d00195df30c), |
| 11 | + [#11667](https://github.com/angular/angular.js/issues/11667)) |
| 12 | +- **$parse:** throw error when accessing a restricted property indirectly |
| 13 | + ([ec98c94c](https://github.com/angular/angular.js/commit/ec98c94ccbfc97b655447956738d5f6ff98b2f33), |
| 14 | + [#12833](https://github.com/angular/angular.js/issues/12833)) |
| 15 | +- **ngModel:** validate pattern against the viewValue |
| 16 | + ([274e9353](https://github.com/angular/angular.js/commit/274e93537ed4e95aefeacea48909eb334894f0ac), |
| 17 | + [#12344](https://github.com/angular/angular.js/issues/12344)) |
| 18 | + |
| 19 | + |
| 20 | +## Features |
| 21 | + |
| 22 | +- **ngAnimate:** introduce `$animate.flush` for unit testing |
| 23 | + ([f98e0384](https://github.com/angular/angular.js/commit/f98e038418f7367b2373adcf4887f64a8e8bdcb0)) |
| 24 | + |
| 25 | + |
| 26 | +## Possible Breaking Changes |
| 27 | + |
| 28 | +- **ngModel:** due to [274e9353](https://github.com/angular/angular.js/commit/274e93537ed4e95aefeacea48909eb334894f0ac), |
| 29 | + |
| 30 | + |
| 31 | +The `ngPattern` and `pattern` directives will validate the regex |
| 32 | +against the `viewValue` of `ngModel`, i.e. the value of the model |
| 33 | +before the $parsers are applied. Previously, the modelValue |
| 34 | +(the result of the $parsers) was validated. |
| 35 | + |
| 36 | +This fixes issues where `input[date]` and `input[number]` cannot |
| 37 | +be validated because the viewValue string is parsed into |
| 38 | +`Date` and `Number` respectively (starting with Angular 1.3). |
| 39 | +It also brings the directives in line with HTML5 constraint |
| 40 | +validation, which validates against the input value. |
| 41 | + |
| 42 | +This change is unlikely to cause applications to fail, because even |
| 43 | +in Angular 1.2, the value that was validated by pattern could have |
| 44 | +been manipulated by the $parsers, as all validation was done |
| 45 | +inside this pipeline. |
| 46 | + |
| 47 | +If you rely on the pattern being validated against the modelValue, |
| 48 | +you must create your own validator directive that overwrites |
| 49 | +the built-in pattern validator: |
| 50 | + |
| 51 | +``` |
| 52 | +.directive('patternModelOverwrite', function patternModelOverwriteDirective() { |
| 53 | + return { |
| 54 | + restrict: 'A', |
| 55 | + require: '?ngModel', |
| 56 | + priority: 1, |
| 57 | + compile: function() { |
| 58 | + var regexp, patternExp; |
| 59 | + |
| 60 | + return { |
| 61 | + pre: function(scope, elm, attr, ctrl) { |
| 62 | + if (!ctrl) return; |
| 63 | + |
| 64 | + attr.$observe('pattern', function(regex) { |
| 65 | + /** |
| 66 | + * The built-in directive will call our overwritten validator |
| 67 | + * (see below). We just need to update the regex. |
| 68 | + * The preLink fn guaranetees our observer is called first. |
| 69 | + */ |
| 70 | + if (isString(regex) && regex.length > 0) { |
| 71 | + regex = new RegExp('^' + regex + '$'); |
| 72 | + } |
| 73 | + |
| 74 | + if (regex && !regex.test) { |
| 75 | + //The built-in validator will throw at this point |
| 76 | + return; |
| 77 | + } |
| 78 | + |
| 79 | + regexp = regex || undefined; |
| 80 | + }); |
| 81 | + |
| 82 | + }, |
| 83 | + post: function(scope, elm, attr, ctrl) { |
| 84 | + if (!ctrl) return; |
| 85 | + |
| 86 | + regexp, patternExp = attr.ngPattern || attr.pattern; |
| 87 | + |
| 88 | + //The postLink fn guarantees we overwrite the built-in pattern validator |
| 89 | + ctrl.$validators.pattern = function(value) { |
| 90 | + return ctrl.$isEmpty(value) || |
| 91 | + isUndefined(regexp) || |
| 92 | + regexp.test(value); |
| 93 | + }; |
| 94 | + } |
| 95 | + }; |
| 96 | + } |
| 97 | + }; |
| 98 | +}); |
| 99 | +``` |
| 100 | + |
| 101 | + |
| 102 | + |
| 103 | + |
1 | 104 | <a name="1.3.18"></a>
|
2 | 105 | # 1.3.18 collective-penmanship (2015-08-18)
|
3 | 106 |
|
|
0 commit comments