Skip to content

Commit b5644d8

Browse files
committed
docs(ngAnimate): add animating between subsequent value changes section
Add a section which covers use case when user's need to animate upon every variable's value change. Refers angular#16561
1 parent 78b9f61 commit b5644d8

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
@@ -267,9 +267,22 @@
267267
* .message.ng-enter-prepare {
268268
* opacity: 0;
269269
* }
270-
*
271270
* ```
272271
*
272+
* ### Animating between value changes
273+
*
274+
* Sometimes you need to animate between different expression states, whose values
275+
* don't necessary need to be known or referenced in CSS styles.
276+
* Unless possible with another ["animation aware" directive](#directive-support), that specific
277+
* use case can always be covered with {@link ngAnimate.directive:ngAnimateSwap} as can be seen in
278+
* {@link ngAnimate.directive:ngAnimateSwap#examples this example}.
279+
*
280+
* Note that {@link ngAnimate.directive:ngAnimateSwap} is a *structural directive*, which means it
281+
* creates a new instance of the element (including any other/child directives it may have) and
282+
* links it to a new scope every time *swap* happens. In some cases this might not be desirable
283+
* (e.g. for performance reasons, or when you wish to retain internal state on the original
284+
* element instance).
285+
*
273286
* ## JavaScript-based Animations
274287
*
275288
* 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)