import { Component } from
'@angular/core'
;
import { ConfirmationService } from
'primeng/api'
;
import { Message } from
'primeng/api'
;
import { PrimeNGConfig } from
'primeng/api'
;
@Component({
selector:
'app-root'
,
templateUrl:
'./app.component.html'
,
styles: [],
providers: [ConfirmationService],
})
export class AppComponent {
ToastMessages: Message[];
pos: string;
constructor(
private confirmationService: ConfirmationService
) {}
decidePos(pos: string) {
this
.pos = pos;
this
.confirmationService.confirm({
message:
'Do you want to buy this course ?'
,
header:
'GeeksforGeeks'
,
icon:
'pi pi-info-circle'
,
accept: () => {
this
.ToastMessages = [
{
severity:
'success'
,
summary:
'Confirmed!'
,
detail:
'You have bought this course.'
,
},
];
},
reject: () => {
this
.ToastMessages = [
{
severity:
'info'
,
summary:
'Failure'
,
detail:
'OOPs! Try buying course next time.'
,
},
];
},
key:
'dialogPos'
,
});
}
}