You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
feat($animateCss): add support for temporary styles via cleanupStyles
Some animations make use of the `from` and `to` styling only for the
lifetime of the animation. This patch allows for those styles to be
removed once the animation is closed automatically within `$animateCss`.
Closes#12930
Copy file name to clipboardexpand all lines: src/ngAnimate/animateCss.js
+41-2
Original file line number
Diff line number
Diff line change
@@ -204,6 +204,10 @@ var ANIMATE_TIMER_KEY = '$$animateCss';
204
204
* * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a
205
205
* * `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)
206
206
* * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occuring on the classes being added and removed.)
207
+
* * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once
208
+
* the animation is closed. This is useful for when the styles are used purely for the sake of
209
+
* the animation and do not have a lasting visual effect on the element (e.g. a colapse and open animation).
210
+
* By default this value is set to `false`.
207
211
*
208
212
* @return {object} an object with start and end methods and details about the animation.
209
213
*
@@ -324,6 +328,23 @@ function createLocalCacheLookup() {
324
328
};
325
329
}
326
330
331
+
// we do not reassign an already present style value since
332
+
// if we detect the style property value again we may be
333
+
// detecting styles that were added via the `from` styles.
334
+
// We make use of `isDefined` here since an empty string
335
+
// or null value (which is what getPropertyValue will return
336
+
// for a non-existing style) will still be marked as a valid
337
+
// value for the style (a falsy value implies that the style
338
+
// is to be removed at the end of the animation). If we had a simple
339
+
// "OR" statement then it would not be enough to catch that.
0 commit comments