@@ -62,7 +62,7 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
62
62
event : event ,
63
63
structural : isStructural ,
64
64
options : options ,
65
- start : start ,
65
+ beforeStart : beforeStart ,
66
66
close : close
67
67
} ) ;
68
68
@@ -88,15 +88,19 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
88
88
animationQueue . length = 0 ;
89
89
90
90
forEach ( groupAnimations ( animations ) , function ( animationEntry ) {
91
- var startFn = animationEntry . start ;
92
- var closeFn = animationEntry . close ;
91
+ // it's important that we apply the `ng-animate` CSS class and the
92
+ // temporary classes before we do any driver invoking since these
93
+ // CSS classes may be required for proper CSS detection.
94
+ animationEntry . beforeStart ( ) ;
95
+
93
96
var operation = invokeFirstDriver ( animationEntry ) ;
94
- var startAnimation = operation && operation . start ; /// TODO(matsko): only recognize operation.start()
95
- if ( ! startAnimation ) {
97
+ var triggerAnimationStart = operation && operation . start ; /// TODO(matsko): only recognize operation.start()
98
+
99
+ var closeFn = animationEntry . close ;
100
+ if ( ! triggerAnimationStart ) {
96
101
closeFn ( ) ;
97
102
} else {
98
- startFn ( ) ;
99
- var animationRunner = startAnimation ( ) ;
103
+ var animationRunner = triggerAnimationStart ( ) ;
100
104
animationRunner . done ( function ( status ) {
101
105
closeFn ( ! status ) ;
102
106
} ) ;
@@ -173,9 +177,9 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
173
177
if ( ! anchorGroups [ lookupKey ] ) {
174
178
var group = anchorGroups [ lookupKey ] = {
175
179
// TODO(matsko): double-check this code
176
- start : function ( ) {
177
- fromAnimation . start ( ) ;
178
- toAnimation . start ( ) ;
180
+ beforeStart : function ( ) {
181
+ fromAnimation . beforeStart ( ) ;
182
+ toAnimation . beforeStart ( ) ;
179
183
} ,
180
184
close : function ( ) {
181
185
fromAnimation . close ( ) ;
@@ -241,7 +245,7 @@ var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
241
245
}
242
246
}
243
247
244
- function start ( ) {
248
+ function beforeStart ( ) {
245
249
element . addClass ( NG_ANIMATE_CLASSNAME ) ;
246
250
if ( tempClasses ) {
247
251
$$jqLite . addClass ( element , tempClasses ) ;
0 commit comments