1
1
import { animate , state , style , transition , trigger } from '@angular/animations' ;
2
2
import { CommonModule } from '@angular/common' ;
3
+ import { DeprecateProperty } from '../core/deprecateDecorators' ;
3
4
import {
4
5
Component ,
5
6
ElementRef ,
@@ -205,10 +206,26 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
205
206
public isVisibleChange = new EventEmitter < boolean > ( ) ;
206
207
207
208
/**
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
209
218
*/
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.` )
210
221
@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
+ }
212
229
213
230
/**
214
231
* Sets/gets the position of the toast.
@@ -235,6 +252,12 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
235
252
return this . elementRef . nativeElement ;
236
253
}
237
254
255
+ /**
256
+ * @hidden
257
+ * @internal
258
+ */
259
+ toastMessage = '' ;
260
+
238
261
/**
239
262
* @hidden
240
263
*/
@@ -252,8 +275,9 @@ export class IgxToastComponent implements IToggleView, OnInit, OnDestroy {
252
275
* ```
253
276
* @memberof IgxToastComponent
254
277
*/
255
- public show ( ) : void {
278
+ public show ( message ?: string ) : void {
256
279
clearInterval ( this . timeoutId ) ;
280
+ if ( message !== undefined ) { this . toastMessage = message ; }
257
281
this . onShowing . emit ( this ) ;
258
282
this . isVisible = true ;
259
283
this . animationState = 'visible' ;
0 commit comments