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

Commit 0ed3643

Browse files
FRSgitgkalpak
authored andcommitted
docs(ngAnimate): add "animating between value changes" section
Add a section which covers use case when users need to animate upon a variable's value changes (not between two states). Refers #16561 Closes #16582
1 parent aa6adc7 commit 0ed3643

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/ngAnimate/module.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,22 @@
275275
* .message.ng-enter-prepare {
276276
* opacity: 0;
277277
* }
278-
*
279278
* ```
280279
*
280+
* ### Animating between value changes
281+
*
282+
* Sometimes you need to animate between different expression states, whose values
283+
* don't necessary need to be known or referenced in CSS styles.
284+
* Unless possible with another ["animation aware" directive](#directive-support), that specific
285+
* use case can always be covered with {@link ngAnimate.directive:ngAnimateSwap} as can be seen in
286+
* {@link ngAnimate.directive:ngAnimateSwap#examples this example}.
287+
*
288+
* Note that {@link ngAnimate.directive:ngAnimateSwap} is a *structural directive*, which means it
289+
* creates a new instance of the element (including any other/child directives it may have) and
290+
* links it to a new scope every time *swap* happens. In some cases this might not be desirable
291+
* (e.g. for performance reasons, or when you wish to retain internal state on the original
292+
* element instance).
293+
*
281294
* ## JavaScript-based Animations
282295
*
283296
* ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared

0 commit comments

Comments
 (0)