AngularJS 1.4.0.rc0 发布,代号为 smooth-unwinding。
此版本现已提供下载:
https://github.com/angular/angular.js/archive/v1.4.0-rc.0.zip
更新内容如下:
Bug 修复
- $compile:
- $http: throw error if
success
anderror
methods do not receive a function (1af563d4,#11330, #11333) - $parse: fix parse errors on older Android WebViews which choke with reserved keywords (10ae33b2,#11455)
- $rootScope: allow destroying a root scope (f8c8cf69,#11241, #10895)
- cookieReader: safely access $document so it can be mocked (a057e089,#11373, #11388)
- filterFilter: fix matching against
null
/undefined
(b5002ab6,#11432, #11445) - ngAnimate: ensure that minified repaint code isn’t removed (c55a4944,#9936)
- ngAria: handle elements with role=”checkbox/menuitemcheckbox” (44337f63,#11317,#11321)
- ngModel: allow setting model to NaN when asyncValidator is present (948120ec,#11315,#11411)
- ngTouch: register touches properly when jQuery is used (06a9f0a9,#4001, #8584, #10797,#11488)
- select: don’t call $render twice if $viewValue ref changes (7e5c447f,#11329, #11412)
新特性
- $anchorScroll: allow scrolling to a specified element (731c8b5e,#4568, #9596)
- $animate: complete refactor of internal animation code (c8700f04)
- $http: support custom params serializers (6c8464ad,#3740, #7429, #9224, #11461)
- $interpolate: extend interpolation with MessageFormat like syntax (1e58488a,#11152)
- angular.Module: add
decorator
method (e57138d7,#11305, #11300) - ngClass: add support for conditional map within an array. (4588e627,#4807)
- travis: run unit tests on iOS 8 (2cdb2016,#11479)
性能提升
- $rootScope: remove history event handler when app is torn down (d996305b,#9897, #9905)
- benchmark: add ngmodel benchmarks to largetable-bp (b8dbdb0c,#11082)
- ngOptions: only perform deep equality check on ngModel if using track by (171b9f7f,#11448, #11447)
重大改进
- $animate: due to c8700f04, JavaSript and CSS animations can no longer be run in parallel. With earlier versions of ngAnimate, both CSS and JS animations would be run together when multiple animations were detected. This feature has now been removed, however, the same effect, with even more possibilities, can be achieved by injecting
$animateCss
into a JavaScript-defined animation and creating custom CSS-based animations from there. Read the ngAnimate docs for more info. - $animate: due to c8700f04, The function params for
$animate.enabled()
when an element is used are now flipped. This fix allows the function to act as a getter when a single element param is provided.
<code class="shell plain">//</code> <code class="shell plain">< 1.4$animate.enabled(</code><code class="shell functions">false</code><code class="shell plain">, element);</code><code class="shell plain">//</code> <code class="shell plain">1.4+$animate.enabled(element, </code><code class="shell functions">false</code><code class="shell plain">);</code>
- $animate: due to c8700f04, In addition to disabling the children of the element,
$animate.enabled(element, false)
will now also disable animations on the element itself. - $animate: due to c8700f04, Animation-related callbacks are now fired on
$animate.on
instead of directly being on the element.
<div class="line number1 index0 alt2"><code class="shell plain">//</code> <code class="shell plain">< 1.4element.on(</code><code class="shell string">'$animate:before'</code><code class="shell plain">, </code><code class="shell keyword">function</code><code class="shell plain">(e, data) { </code><code class="shell keyword">if</code> <code class="shell plain">(data.event === </code><code class="shell string">'enter'</code><code class="shell plain">) { … }</code></div>
<div class="line number2 index1 alt1"><code class="shell plain">});</code></div>
<div class="line number3 index2 alt2"><code class="shell plain">element.off(</code><code class="shell string">'$animate:before'</code><code class="shell plain">, fn);</code><code class="shell plain">//</code> <code class="shell plain">1.4+$animate.on(element, </code><code class="shell string">'enter'</code><code class="shell plain">, </code><code class="shell keyword">function</code><code class="shell plain">(data) { </code><code class="shell plain">//</code><code class="shell plain">…});</code></div>
<div class="line number4 index3 alt1"><code class="shell plain">$animate.off(element, </code><code class="shell string">'enter'</code><code class="shell plain">, fn);</code></div>
- $animate: due to c8700f04, There is no need to call
$scope.$apply
or$scope.$digest
inside of a animation promise callback anymore since the promise is resolved within a digest automatically (but a digest is not run unless the promise is chained).
<div class="line number1 index0 alt2"><code class="js comments">// < 1.4$animate.enter(element).then(function() {</code></div>
<div class="line number2 index1 alt1"><code class="js spaces"> </code><code class="js plain">$scope.$apply(</code><code class="js keyword">function</code><code class="js plain">() {</code></div>
<div class="line number3 index2 alt2"><code class="js spaces"> </code><code class="js plain">$scope.explode = </code><code class="js keyword">true</code><code class="js plain">;</code></div>
<div class="line number4 index3 alt1"><code class="js spaces"> </code><code class="js plain">});</code></div>
<div class="line number5 index4 alt2"><code class="js plain">});</code><code class="js comments">// 1.4+$animate.enter(element).then(function() {</code></div>
<div class="line number6 index5 alt1"><code class="js spaces"> </code><code class="js plain">$scope.explode = </code><code class="js keyword">true</code><code class="js plain">;</code></div>
<div class="line number7 index6 alt2"><code class="js plain">});</code></div>
- $animate: due to c8700f04, When an enter, leave or move animation is triggered then it will always end any pending or active parent class based animations (animations triggered via ngClass) in order to ensure that any CSS styles are resolved in time.
更多内容请看更新日志。