Skip to content

Commit 9b2fbaf

Browse files
committed
refactor(docs): log events
1 parent 291437c commit 9b2fbaf

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

src/app/toast/toast.sample.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ <h4 class="sample-title">Toggle Toast</h4>
8181

8282
<div igxOverlayOutlet #outlet="overlay-outlet"></div>
8383

84-
<igx-toast #toast [outlet]="outlet">
84+
<igx-toast
85+
#toast
86+
[outlet]="outlet"
87+
(onShowing)="handleShowing($event)"
88+
(onShown)="handleShown($event)"
89+
(onHiding)="handleHiding($event)"
90+
(onHidden)="handleHidden($event)"
91+
>
8592
This message will self-destruct in 4 seconds.
8693
</igx-toast>

src/app/toast/toast.sample.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Component } from '@angular/core';
1+
import { Component, ViewChild } from '@angular/core';
22
import { IgxToastComponent, IgxToastPosition } from 'igniteui-angular';
33

44
@Component({
@@ -7,8 +7,30 @@ import { IgxToastComponent, IgxToastPosition } from 'igniteui-angular';
77
templateUrl: 'toast.sample.html',
88
})
99
export class ToastSampleComponent {
10+
@ViewChild('toast')
11+
public toast: IgxToastComponent;
12+
13+
public toastVisibility = false;
14+
1015
showToast(toast: IgxToastComponent, pos: IgxToastPosition) {
1116
toast.position = pos;
1217
toast.show();
1318
}
19+
20+
handleShowing(event) {
21+
console.log('showing toast', event);
22+
}
23+
24+
handleShown(event) {
25+
console.log('toast shown', event);
26+
27+
}
28+
29+
handleHiding(event) {
30+
console.log('toast hiding', event);
31+
}
32+
33+
handleHidden(event) {
34+
console.log('toast hidden', event);
35+
}
1436
}

0 commit comments

Comments
 (0)