@@ -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,12 +139,15 @@ 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
- and compatible with dynamic message data. The ngMessage directive now supports a new attribute called `ng-message-exp`
143
- which will evaluate an expression and will keep track of that expression as it changes in order to re-evaluate
144
- the listed messages.
142
+ The ngMessages module has also been subject to an internal refactor to allow it to be more flexible
143
+ and compatible with dynamic message data. The ` ngMessage` directive now supports a new attribute
144
+ called `ng-message-exp` which will evaluate an expression and will keep track of that expression
145
+ as it changes in order to re-evaluate the listed messages.
145
146
146
- There is only one breaking change. Please consider the following when including remote message templates via `ng-messages-include`:
147
+ [Click here to learn more about dynamic ng-messages](https://docs.angularjs.org/api/ngMessages#dynamic-messaging)
148
+
149
+ There is only one breaking change. Please consider the following when including remote
150
+ message templates via `ng-messages-include`:
147
151
148
152
Due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
149
153
the `ngMessagesInclude` attribute has now been removed and cannot be used in the same element containing
@@ -168,11 +172,14 @@ before and after it.
168
172
169
173
### ngOptions
170
174
175
+ The `ngOptions` directive has also been refactored and as a result some long-standing bugs
176
+ have been fixed. The breaking changes are comparatively minor and should not affect most applications.
177
+
171
178
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).
179
+ when `ngOptions` renders the option values within the DOM, the resulting HTML code is different.
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).
176
183
177
184
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
178
185
when iterating over an object's properties using the `(key, value) in obj` syntax
@@ -183,8 +190,6 @@ in the order they are returned by Object.keys(obj), which is almost always the o
183
190
in which the properties were defined.
184
191
185
192
186
-
187
-
188
193
## Templating (`ngRepeat`, `$compile`)
189
194
190
195
### ngRepeat
@@ -218,9 +223,15 @@ is marked as optional and the attribute is not specified, no function will be ad
218
223
219
224
Due to [38fbe3ee](https://github.com/angular/angular.js/commit/38fbe3ee8370fc449b82d80df07b5c2ed2cd5fbe),
220
225
`$cookies` will no longer expose properties that represent the current browser cookie
221
- values.
226
+ values. `$cookies` no longer polls the browser for changes to the cookies and ***no longer copies
227
+ cookie values onto the `$cookies` object***.
222
228
223
- The new API on `$cookies` includes:
229
+ This was changed because the polling is expensive and caused issues with the `$cookies` properties
230
+ not synchronizing correctly with the actual browser cookie values (The reason the polling
231
+ was originally added was to allow communication between different tabs,
232
+ but there are better ways to do this today, for example `localStorage`.)
233
+
234
+ The new API on `$cookies` is as follows:
224
235
225
236
* `get`
226
237
* `put`
@@ -229,17 +240,8 @@ The new API on `$cookies` includes:
229
240
* `getAll`
230
241
* `remove`
231
242
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
243
+ You must explictly use the methods above in order to access cookie data. This also means that
244
+ you can no longer watch the properties on `$cookies` to detect changes
243
245
that occur on the browsers cookies.
244
246
245
247
This feature is generally only needed if a 3rd party library was programmatically
@@ -293,8 +295,8 @@ $http.get(url, {
293
295
294
296
### `filter` filter
295
297
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 .
298
+ the `filter` filter will throw an error when used with a non- array. Beforehand it would silently
299
+ return an empty array.
298
300
299
301
If necessary, this can be worked around by converting an object to an array,
300
302
using a filter such as https://github.com/petebacondarwin/angular-toArrayFilter.
0 commit comments