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

Commit 0c6d92a

Browse files
committed
docs(migration): general improvements
1 parent cc96188 commit 0c6d92a

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

docs/content/guide/migration.ngdoc

+30-29
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ which drives many of these changes.
1515

1616
# Migrating from 1.3 to 1.4
1717

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`.
2021

2122
The reason for the ngAnimate refactor was to fix timing issues and to expose new APIs to allow
2223
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.
2425
If animation is something of interest, then please read over the breaking changes below for animations when
2526
`ngAnimate` is used.
2627

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
2829
to render error messages with ngMessages that are listed with a directive such as ngRepeat. A great usecase for this
2930
involves pulling error message data from a server and then displaying that data via the mechanics of ngMessages. Be
3031
sure to read the breaking change involved with `ngMessagesInclude` to upgrade your template code.
@@ -38,14 +39,14 @@ relatively straightforward otherwise.
3839

3940
## Animation (`ngAnimate`)
4041

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.
4344

4445
Due to [c8700f04](https://github.com/angular/angular.js/commit/c8700f04fb6fb5dc21ac24de8665c0476d6db5ef),
4546
JavaSript and CSS animations can no longer be run in
4647
parallel. With earlier versions of ngAnimate, both CSS and JS animations
4748
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
4950
possibilities, can be achieved by injecting `$animateCss` into a
5051
JavaScript-defined animation and creating custom CSS-based animations
5152
from there.
@@ -138,11 +139,13 @@ class based animations (animations triggered via ngClass) in order to ensure tha
138139
## Forms (`ngMessages`, `ngOptions`)
139140

140141
### 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
142143
and compatible with dynamic message data. The ngMessage directive now supports a new attribute called `ng-message-exp`
143144
which will evaluate an expression and will keep track of that expression as it changes in order to re-evaluate
144145
the listed messages.
145146

147+
[Click here to learn more about dynamic ng-messages](https://docs.angularjs.org/api/ngMessages#dynamic-messaging)
148+
146149
There is only one breaking change. Please consider the following when including remote message templates via `ng-messages-include`:
147150

148151
Due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
@@ -168,11 +171,14 @@ before and after it.
168171

169172
### ngOptions
170173

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+
171177
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).
176182

177183
Due to [7fda214c](https://github.com/angular/angular.js/commit/7fda214c4f65a6a06b25cf5d5aff013a364e9cef),
178184
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
183189
in which the properties were defined.
184190

185191

186-
187-
188192
## Templating (`ngRepeat`, `$compile`)
189193

190194
### ngRepeat
@@ -218,9 +222,15 @@ is marked as optional and the attribute is not specified, no function will be ad
218222

219223
Due to [38fbe3ee](https://github.com/angular/angular.js/commit/38fbe3ee8370fc449b82d80df07b5c2ed2cd5fbe),
220224
`$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***.
222227

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:
224234

225235
* `get`
226236
* `put`
@@ -229,17 +239,8 @@ The new API on `$cookies` includes:
229239
* `getAll`
230240
* `remove`
231241

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
243244
that occur on the browsers cookies.
244245

245246
This feature is generally only needed if a 3rd party library was programmatically
@@ -293,8 +294,8 @@ $http.get(url, {
293294

294295
### `filter` filter
295296
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.
298299

299300
If necessary, this can be worked around by converting an object to an array,
300301
using a filter such as https://github.com/petebacondarwin/angular-toArrayFilter.

0 commit comments

Comments
 (0)