@@ -15,6 +15,7 @@ import {
15
15
Output
16
16
} from '@angular/core' ;
17
17
import { fadeIn , fadeOut , slideInBottom , slideOutBottom } from '../animations/main' ;
18
+ import { DeprecateProperty } from '../core/deprecateDecorators' ;
18
19
19
20
let NEXT_ID = 0 ;
20
21
/**
@@ -101,6 +102,7 @@ export class IgxSnackbarComponent {
101
102
@HostBinding ( 'attr.id' )
102
103
@Input ( )
103
104
public id = `igx-snackbar-${ NEXT_ID ++ } ` ;
105
+
104
106
/**
105
107
* Sets/gets the `message` attribute.
106
108
* ```html
@@ -110,7 +112,15 @@ export class IgxSnackbarComponent {
110
112
* let message = this.snackbar.message;
111
113
* ```
112
114
*/
113
- @Input ( ) public message : string ;
115
+ @DeprecateProperty ( `'message' property is deprecated.
116
+ You can use place the message in the snackbar content or pass a message parameter to the show method instead.` )
117
+ @Input ( )
118
+ public set message ( value : string ) {
119
+ this . snackbarMessage = value ;
120
+ }
121
+ public get message ( ) {
122
+ return this . snackbarMessage ;
123
+ }
114
124
115
125
/**
116
126
* Enables/Disables the visibility of the snackbar.
@@ -182,6 +192,13 @@ export class IgxSnackbarComponent {
182
192
* ```
183
193
*/
184
194
@Output ( ) public animationDone = new EventEmitter < AnimationEvent > ( ) ;
195
+
196
+ /**
197
+ * @hidden
198
+ * @internal
199
+ */
200
+ snackbarMessage = '' ;
201
+
185
202
/**
186
203
* @hidden
187
204
*/
@@ -195,8 +212,9 @@ export class IgxSnackbarComponent {
195
212
* this.snackbar.show();
196
213
* ```
197
214
*/
198
- public show ( ) : void {
215
+ public show ( msg ?: string ) : void {
199
216
clearTimeout ( this . timeoutId ) ;
217
+ if ( msg !== undefined ) { this . snackbarMessage = msg ; }
200
218
setTimeout ( this . timeoutId ) ;
201
219
this . isVisible = true ;
202
220
0 commit comments