11import { animate , state , style , transition , trigger } from '@angular/animations' ;
22import { CommonModule } from '@angular/common' ;
3+ import { DeprecateProperty } from '../core/deprecateDecorators' ;
34import {
45 Component ,
56 ElementRef ,
@@ -205,10 +206,26 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
205206 public isVisibleChange = new EventEmitter < boolean > ( ) ;
206207
207208 /**
208- * @hidden
209+ * @deprecated Place your message in the toast content instead.
210+ * Sets/gets the message that will be shown by the toast.
211+ * ```html
212+ * <igx-toast [message] = "Notification"></igx-toast>
213+ * ```
214+ * ```typescript
215+ * let toastMessage = this.toast.message;
216+ * ```
217+ * @memberof IgxToastComponent
209218 */
219+ @DeprecateProperty ( `'message' property is deprecated.
220+ You can use place the message in the toast content or pass it as parameter to the show method instead.` )
210221 @Input ( )
211- public message = '' ;
222+ public set message ( value : string ) {
223+ this . toastMessage = value ;
224+ }
225+
226+ public get message ( ) {
227+ return this . toastMessage ;
228+ }
212229
213230 /**
214231 * Sets/gets the position of the toast.
@@ -235,6 +252,12 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
235252 return this . elementRef . nativeElement ;
236253 }
237254
255+ /**
256+ * @hidden
257+ * @internal
258+ */
259+ toastMessage = '' ;
260+
238261 /**
239262 * @hidden
240263 */
@@ -252,8 +275,9 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
252275 * ```
253276 * @memberof IgxToastComponent
254277 */
255- public show ( ) : void {
278+ public show ( message ?: string ) : void {
256279 clearInterval ( this . timeoutId ) ;
280+ if ( message !== undefined ) { this . toastMessage = message ; }
257281 this . onShowing . emit ( this ) ;
258282 this . isVisible = true ;
259283 this . animationState = 'visible' ;
0 commit comments