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

Commit d9bf6e3

Browse files
committed
docs(migration): general style improvements
Closes #11849
1 parent f7a4b48 commit d9bf6e3

File tree

1 file changed

+35
-33
lines changed

1 file changed

+35
-33
lines changed

docs/content/guide/migration.ngdoc

+35-33
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,12 +139,15 @@ 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-
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.
145146

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`:
147151

148152
Due to [c9a4421f](https://github.com/angular/angular.js/commit/c9a4421fc3c97448527eadef1f42eb2f487ec2e0),
149153
the `ngMessagesInclude` attribute has now been removed and cannot be used in the same element containing
@@ -168,11 +172,14 @@ before and after it.
168172

169173
### ngOptions
170174

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+
171178
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).
176183

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

185192

186-
187-
188193
## Templating (`ngRepeat`, `$compile`)
189194

190195
### ngRepeat
@@ -218,9 +223,15 @@ is marked as optional and the attribute is not specified, no function will be ad
218223

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

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

225236
* `get`
226237
* `put`
@@ -229,17 +240,8 @@ The new API on `$cookies` includes:
229240
* `getAll`
230241
* `remove`
231242

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
243245
that occur on the browsers cookies.
244246

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

294296
### `filter` filter
295297
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.
298300

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

0 commit comments

Comments
 (0)