|
1 | 1 | import { CommonModule } from '@angular/common'; |
2 | 2 | import { Component, inject } from '@angular/core'; |
3 | | -import { AsyncAction, ButtonComponent, FlexComponent, NotificationService, TabComponent, TabGroupComponent } from '@mantic-ui/angular'; |
| 3 | +import { AsyncAction, ButtonComponent, FlexComponent, NotificationRef, NotificationService, TabComponent, TabGroupComponent } from '@mantic-ui/angular'; |
4 | 4 | import { ExampleCodeComponent, ExampleComponent } from '@mantic-ui/angular-doc'; |
5 | 5 | import { HeaderComponent } from '../../components/header/header.component'; |
6 | 6 | import { CustomNotificationComponent } from './custom-notification/custom-notification.component'; |
@@ -56,6 +56,7 @@ export class DemoComponent { |
56 | 56 | this.asyncAction = undefined; |
57 | 57 | } |
58 | 58 | }`; |
| 59 | + protected manualNotification: NotificationRef | undefined; |
59 | 60 |
|
60 | 61 | protected showError(): void { |
61 | 62 | this.notificationService.error('Error Text'); |
@@ -112,4 +113,27 @@ export class CustomNotificationComponent { |
112 | 113 | alert('You clicked the button!'); |
113 | 114 | } |
114 | 115 | }`; |
| 116 | + |
| 117 | + public showManual(): void { |
| 118 | + this.manualNotification = this.notificationService.error('A error that can be closed manually by click on the hide button'); |
| 119 | + } |
| 120 | + |
| 121 | + public hideManual(): void { |
| 122 | + this.manualNotification?.close(); |
| 123 | + this.manualNotification = undefined; |
| 124 | + } |
| 125 | + |
| 126 | + public exampleManual = `import { NotificationService, NotificationRef } from '@mantic-ui/angular'; |
| 127 | +
|
| 128 | +notificationService = inject(NotificationService); |
| 129 | +manualNotification: NotificationRef | undefined; |
| 130 | +
|
| 131 | +showManual(): void { |
| 132 | + this.manualNotification = this.notificationService.error('A error...'); |
| 133 | +} |
| 134 | +
|
| 135 | +hideManual(): void { |
| 136 | + this.manualNotification?.close(); |
| 137 | + this.manualNotification = undefined; |
| 138 | +}';`; |
115 | 139 | } |
0 commit comments