@@ -96,6 +96,12 @@ var $AnimateProvider = ['$provide', function($provide) {
96
96
return currentDefer . promise ;
97
97
}
98
98
99
+ function applyStyles ( element , styles ) {
100
+ if ( angular . isObject ( styles ) ) {
101
+ element . css ( styles . after || styles ) ;
102
+ }
103
+ }
104
+
99
105
/**
100
106
*
101
107
* @ngdoc service
@@ -128,9 +134,11 @@ var $AnimateProvider = ['$provide', function($provide) {
128
134
* a child (if the after element is not present)
129
135
* @param {DOMElement } after the sibling element which will append the element
130
136
* after itself
137
+ * @param {object= } styles an optional collection of styles that will be applied to the element.
131
138
* @return {Promise } the animation callback promise
132
139
*/
133
- enter : function ( element , parent , after ) {
140
+ enter : function ( element , parent , after , styles ) {
141
+ applyStyles ( element , styles ) ;
134
142
after ? after . after ( element )
135
143
: parent . prepend ( element ) ;
136
144
return asyncPromise ( ) ;
@@ -144,9 +152,10 @@ var $AnimateProvider = ['$provide', function($provide) {
144
152
* @description Removes the element from the DOM. When the function is called a promise
145
153
* is returned that will be resolved at a later time.
146
154
* @param {DOMElement } element the element which will be removed from the DOM
155
+ * @param {object= } styles an optional collection of styles that will be applied to the element.
147
156
* @return {Promise } the animation callback promise
148
157
*/
149
- leave : function ( element ) {
158
+ leave : function ( element , styles ) {
150
159
element . remove ( ) ;
151
160
return asyncPromise ( ) ;
152
161
} ,
@@ -166,12 +175,13 @@ var $AnimateProvider = ['$provide', function($provide) {
166
175
* inserted into (if the after element is not present)
167
176
* @param {DOMElement } after the sibling element where the element will be
168
177
* positioned next to
178
+ * @param {object= } styles an optional collection of styles that will be applied to the element.
169
179
* @return {Promise } the animation callback promise
170
180
*/
171
- move : function ( element , parent , after ) {
181
+ move : function ( element , parent , after , styles ) {
172
182
// Do not remove element before insert. Removing will cause data associated with the
173
183
// element to be dropped. Insert will implicitly do the remove.
174
- return this . enter ( element , parent , after ) ;
184
+ return this . enter ( element , parent , after , styles ) ;
175
185
} ,
176
186
177
187
/**
@@ -184,15 +194,17 @@ var $AnimateProvider = ['$provide', function($provide) {
184
194
* @param {DOMElement } element the element which will have the className value
185
195
* added to it
186
196
* @param {string } className the CSS class which will be added to the element
197
+ * @param {object= } styles an optional collection of styles that will be applied to the element.
187
198
* @return {Promise } the animation callback promise
188
199
*/
189
- addClass : function ( element , className ) {
200
+ addClass : function ( element , className , styles ) {
190
201
className = ! isString ( className )
191
202
? ( isArray ( className ) ? className . join ( ' ' ) : '' )
192
203
: className ;
193
204
forEach ( element , function ( element ) {
194
205
jqLiteAddClass ( element , className ) ;
195
206
} ) ;
207
+ applyStyles ( element , styles ) ;
196
208
return asyncPromise ( ) ;
197
209
} ,
198
210
@@ -206,15 +218,17 @@ var $AnimateProvider = ['$provide', function($provide) {
206
218
* @param {DOMElement } element the element which will have the className value
207
219
* removed from it
208
220
* @param {string } className the CSS class which will be removed from the element
221
+ * @param {object= } styles an optional collection of styles that will be applied to the element.
209
222
* @return {Promise } the animation callback promise
210
223
*/
211
- removeClass : function ( element , className ) {
224
+ removeClass : function ( element , className , styles ) {
212
225
className = ! isString ( className )
213
226
? ( isArray ( className ) ? className . join ( ' ' ) : '' )
214
227
: className ;
215
228
forEach ( element , function ( element ) {
216
229
jqLiteRemoveClass ( element , className ) ;
217
230
} ) ;
231
+ applyStyles ( element , styles ) ;
218
232
return asyncPromise ( ) ;
219
233
} ,
220
234
@@ -229,11 +243,13 @@ var $AnimateProvider = ['$provide', function($provide) {
229
243
* removed from it
230
244
* @param {string } add the CSS classes which will be added to the element
231
245
* @param {string } remove the CSS class which will be removed from the element
246
+ * @param {object= } styles an optional collection of styles that will be applied to the element.
232
247
* @return {Promise } the animation callback promise
233
248
*/
234
- setClass : function ( element , add , remove ) {
249
+ setClass : function ( element , add , remove , styles ) {
235
250
this . addClass ( element , add ) ;
236
251
this . removeClass ( element , remove ) ;
252
+ applyStyles ( element , styles ) ;
237
253
return asyncPromise ( ) ;
238
254
} ,
239
255
0 commit comments