@@ -155,6 +155,10 @@ function MdToastDirective($mdToast) {
155
155
* <td>`.theme(string)`</td>
156
156
* <td>Sets the theme on the toast to the requested theme. Default is `$mdThemingProvider`'s default.</td>
157
157
* </tr>
158
+ * <tr>
159
+ * <td>`.toastClass(string)`</td>
160
+ * <td>Sets a class on the toast element</td>
161
+ * </tr>
158
162
* </tbody>
159
163
* </table>
160
164
*
@@ -206,6 +210,7 @@ function MdToastDirective($mdToast) {
206
210
* Available: any combination of `'bottom'`, `'left'`, `'top'`, `'right'`, `'end'` and `'start'`.
207
211
* The properties `'end'` and `'start'` are dynamic and can be used for RTL support.<br/>
208
212
* Default combination: `'bottom left'`.
213
+ * - `toastClass` - `{string=}`: A class to set on the toast element.
209
214
* - `controller` - `{string=}`: The controller to associate with this toast.
210
215
* The controller will be injected the local `$mdToast.hide( )`, which is a function
211
216
* used to hide the toast.
@@ -267,7 +272,7 @@ function MdToastProvider($$interimElementProvider) {
267
272
var activeToastContent ;
268
273
var $mdToast = $$interimElementProvider ( '$mdToast' )
269
274
. setDefaults ( {
270
- methods : [ 'position' , 'hideDelay' , 'capsule' , 'parent' , 'position' ] ,
275
+ methods : [ 'position' , 'hideDelay' , 'capsule' , 'parent' , 'position' , 'toastClass' ] ,
271
276
options : toastDefaultOptions
272
277
} )
273
278
. addPreset ( 'simple' , {
@@ -326,6 +331,7 @@ function MdToastProvider($$interimElementProvider) {
326
331
return {
327
332
onShow : onShow ,
328
333
onRemove : onRemove ,
334
+ toastClass : '' ,
329
335
position : 'bottom left' ,
330
336
themable : true ,
331
337
hideDelay : 3000 ,
@@ -388,10 +394,12 @@ function MdToastProvider($$interimElementProvider) {
388
394
}
389
395
390
396
element . addClass ( '_md-' + swipe ) ;
397
+
391
398
$mdUtil . nextTick ( $mdToast . cancel ) ;
392
399
} ;
393
400
options . openClass = toastOpenClass ( options . position ) ;
394
401
402
+ element . addClass ( options . toastClass ) ;
395
403
396
404
// 'top left' -> 'md-top md-left'
397
405
options . parent . addClass ( options . openClass ) ;
0 commit comments