1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
import { Component, OnInit, ViewChild, TemplateRef } from '@angular/core';
import { NzNotificationService } from 'ng-zorro-antd';
@Component({
selector: 'app-notification',
templateUrl: './notification.component.html',
styleUrls: ['./notification.component.less']
})
export class NotificationComponent implements OnInit {
@ViewChild('notificationModel')notificationModel: any;
notificationAttributes: {
title: string,
imgPath: string,
action: string,
status: string,
name: string
};
constructor(private notification: NzNotificationService) { }
ngOnInit() {
}
setNotification({ title, imgPath, action, status, name }):void{
this.notificationAttributes = { title, imgPath, action, status, name }
}
notificationSuccess(title: string, action: string, name: string): void {
this.notification.remove()
this.setNotification({ title, imgPath: "assets/images/execute-success.png", action, status: 'Success', name })
this.notification.template(this.notificationModel);
}
notificationFailed(title: string, action: string, name: string): void {
this.notification.remove()
this.setNotification({ title, imgPath: "assets/images/execute-faild.png", action, status: 'Failed', name })
this.notification.template(this.notificationModel)
}
}
|