@@ -15,16 +15,17 @@ which drives many of these changes.
15
15
16
16
# Migrating from 1.3 to 1.4
17
17
18
- Angular 1.4 fixes the major animation issues and introduces some breaking changes for `cookies`, `ngMessages`,
19
- `$compile`, `ngRepeat`, `ngOptions `and some fixes to core filters: `limitTo` and `filter`.
18
+ Angular 1.4 fixes major animation issues and introduces a new API for `ngCookies`. Further, there
19
+ are changes to `ngMessages`, `$compile`, `ngRepeat`, `ngOptions `and some fixes to core filters:
20
+ `limitTo` and `filter`.
20
21
21
22
The reason for the ngAnimate refactor was to fix timing issues and to expose new APIs to allow
22
23
for developers to construct more versatile animations. We now have access to `$animateCss`
23
- and the many timing-oriented bugs were fixed which resulted in more smoother animations.
24
+ and the many timing-oriented bugs were fixed which results in smoother animations.
24
25
If animation is something of interest, then please read over the breaking changes below for animations when
25
26
`ngAnimate` is used.
26
27
27
- ngMessages has also been upgraded to allow for dynamic message resolution. This handy feature allows for developers
28
+ ` ngMessages` has been upgraded to allow for dynamic message resolution. This handy feature allows for developers
28
29
to render error messages with ngMessages that are listed with a directive such as ngRepeat. A great usecase for this
29
30
involves pulling error message data from a server and then displaying that data via the mechanics of ngMessages. Be
30
31
sure to read the breaking change involved with `ngMessagesInclude` to upgrade your template code.
@@ -38,14 +39,14 @@ relatively straightforward otherwise.
38
39
39
40
## Animation (`ngAnimate`)
40
41
41
- Animation in 1.4 have been refactored internally and the API has stayed much the same. There are, however,
42
- some breaking changes that need to be addressed when any Angular animation code is upgraded to work in 1.4.
42
+ Animations in 1.4 have been refactored internally, but the API has stayed much the same. There are, however,
43
+ some breaking changes that need to be addressed when upgrading to 1.4.
43
44
44
45
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
45
46
JavaSript and CSS animations can no longer be run in
46
47
parallel. With earlier versions of ngAnimate, both CSS and JS animations
47
48
would be run together when multiple animations were detected. This
48
- feature has now been removed, however, the same effect, with even more
49
+ feature has been removed, however, the same effect, with even more
49
50
possibilities, can be achieved by injecting `$animateCss` into a
50
51
JavaScript-defined animation and creating custom CSS-based animations
51
52
from there.
@@ -138,11 +139,13 @@ class based animations (animations triggered via ngClass) in order to ensure tha
138
139
## Forms (`ngMessages`, `ngOptions`)
139
140
140
141
### ngMessages
141
- The ngMessages module has also been subject to an internal refactor to allow the feature to be more flexible
142
+ The ngMessages module has also been subject to an internal refactor to allow it to be more flexible
142
143
and compatible with dynamic message data. The ngMessage directive now supports a new attribute called `ng-message-exp`
143
144
which will evaluate an expression and will keep track of that expression as it changes in order to re-evaluate
144
145
the listed messages.
145
146
147
+ [Click here to learn more about dynamic ng-messages](https://docs.angularjs.org/api/ngMessages#dynamic-messaging)
148
+
146
149
There is only one breaking change. Please consider the following when including remote message templates via `ng-messages-include`:
147
150
148
151
Due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
@@ -168,11 +171,14 @@ before and after it.
168
171
169
172
### ngOptions
170
173
174
+ The `ngOptions` directive has also been refactored and as result some long-standing bugs
175
+ have been fixed. The breaking changes are comparatively minor and should not affect most applications.
176
+
171
177
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
172
- when `ngOptions` renders the option values within the DOM, the resulting HTML code is different. Normally this
173
- should not affect your application at all, however, if your code relies on inspecing the value property of `<option>`
174
- elements (that `ngOptions` generates) then be sure to read the details
175
- [here] (https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef).
178
+ when `ngOptions` renders the option values within the DOM, the resulting HTML code is different.
179
+ Normally this should not affect your application at all, however, if your code relies on inspecting
180
+ the value property of `<option>` elements (that `ngOptions` generates) then be sure to [ read the details]
181
+ (https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef).
176
182
177
183
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
178
184
when iterating over an object's properties using the `(key, value) in obj` syntax
@@ -183,8 +189,6 @@ in the order they are returned by Object.keys(obj), which is almost always the o
183
189
in which the properties were defined.
184
190
185
191
186
-
187
-
188
192
## Templating (`ngRepeat`, `$compile`)
189
193
190
194
### ngRepeat
@@ -218,9 +222,15 @@ is marked as optional and the attribute is not specified, no function will be ad
218
222
219
223
Due to [38fbe3ee](https://github.com/angular/angular.js/commit/38fbe3ee8370fc449b82d80df07b5c2ed2cd5fbe),
220
224
`$cookies` will no longer expose properties that represent the current browser cookie
221
- values.
225
+ values. `$cookies`no longer polls the browser for changes to the cookies and ***no longer copies
226
+ cookie values onto the `$cookies` object***.
222
227
223
- The new API on `$cookies` includes:
228
+ This was changed because the polling is expensive and caused issues with the `$cookies` properties
229
+ not synchronizing correctly with the actual browser cookie values (The reason the polling
230
+ was originally added was to allow communication between different tabs,
231
+ but there are better ways to do this today, for example `localStorage`).
232
+
233
+ The new API on `$cookies` is as follows:
224
234
225
235
* `get`
226
236
* `put`
@@ -229,17 +239,8 @@ The new API on `$cookies` includes:
229
239
* `getAll`
230
240
* `remove`
231
241
232
- The new API no longer polls the browser for changes to the cookies and no longer copy
233
- cookie values onto the `$cookies` object.
234
-
235
- The polling is expensive and caused issues with the `$cookies` properties not
236
- synchronizing correctly with the actual browser cookie values.
237
-
238
- The reason the polling was originally added was to allow communication between
239
- different tabs, but there are better ways to do this today (for example `localStorage`).
240
-
241
- Now you must explictly use the methods above in order to access cookie data. This also means that
242
- you can no longer watch the any properties on `$cookies` for changes to detect for any changes
242
+ You must explictly use the methods above in order to access cookie data. This also means that
243
+ you can no longer watch the any properties on `$cookies` to detect any changes
243
244
that occur on the browsers cookies.
244
245
245
246
This feature is generally only needed if a 3rd party library was programmatically
@@ -293,8 +294,8 @@ $http.get(url, {
293
294
294
295
### `filter` filter
295
296
Due to [cea8e751](https://github.com/angular/angular.js/commit/cea8e75144e6910b806b63a6ec2a6d118316fddd),
296
- the `filter` filter will throw an error when a non array. Beforehand it would silently ignore the error
297
- and return an empty array. This is not the behavior anymore .
297
+ the `filter` filter will throw an error when used with a non- array. Beforehand it would silently
298
+ return an empty array.
298
299
299
300
If necessary, this can be worked around by converting an object to an array,
300
301
using a filter such as https://github.com/petebacondarwin/angular-toArrayFilter.
0 commit comments