@@ -15,6 +15,7 @@ import {
1515 Output
1616} from '@angular/core' ;
1717import { fadeIn , fadeOut , slideInBottom , slideOutBottom } from '../animations/main' ;
18+ import { DeprecateProperty } from '../core/deprecateDecorators' ;
1819
1920let NEXT_ID = 0 ;
2021/**
@@ -101,6 +102,7 @@ export class IgxSnackbarComponent {
101102 @HostBinding ( 'attr.id' )
102103 @Input ( )
103104 public id = `igx-snackbar-${ NEXT_ID ++ } ` ;
105+
104106 /**
105107 * Sets/gets the `message` attribute.
106108 * ```html
@@ -110,7 +112,15 @@ export class IgxSnackbarComponent {
110112 * let message = this.snackbar.message;
111113 * ```
112114 */
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+ }
114124
115125 /**
116126 * Enables/Disables the visibility of the snackbar.
@@ -182,6 +192,13 @@ export class IgxSnackbarComponent {
182192 * ```
183193 */
184194 @Output ( ) public animationDone = new EventEmitter < AnimationEvent > ( ) ;
195+
196+ /**
197+ * @hidden
198+ * @internal
199+ */
200+ snackbarMessage = '' ;
201+
185202 /**
186203 * @hidden
187204 */
@@ -195,8 +212,9 @@ export class IgxSnackbarComponent {
195212 * this.snackbar.show();
196213 * ```
197214 */
198- public show ( ) : void {
215+ public show ( msg ?: string ) : void {
199216 clearTimeout ( this . timeoutId ) ;
217+ if ( msg !== undefined ) { this . snackbarMessage = msg ; }
200218 setTimeout ( this . timeoutId ) ;
201219 this . isVisible = true ;
202220
0 commit comments