Prime-ng Confirm Dialog: Hide The Button After Confirmation
I'm struggling with a problem using Angular and PrimeNG. There is an Input Field for weight allowing numbers up to 150. If the typed in value is greater than 150, a Confirm Button
Solution 1:
You can simply take one bool variable and set it on confirmDialog button click
messagesWeightTest: Message[] = [];
public weightConfirmed: boolean = false;
confirmWeightTest() {
this.confirmationService.confirm({
message: 'Are you sure?',
header: 'Confirmation',
icon: 'pi pi-exclamation-triangle',
key: 'confirmWeightTest',
accept: () => {
this.messagesWeightTest = [{
severity: 'info', summary: 'Confirmed', detail: 'The input is correct.'}];
this.weightConfirmed = true;
},
reject: () => {
this.sessionService.newTest.testWeight = null;
this.weightConfirmed = true;
}
});
}
<div *ngIf="validateIfWeightOutsideRange()"><div><p-confirmDialogkey="confirmWeightTest"></p-confirmDialog><button *ngIf="!weightConfirmed"type="button" (click)="confirmWeightTest()"pButtonicon="pi pi-check"label="Please confirm!"></button><p-messages [value]="messagesWeightTest"></p-messages></div></div>
Post a Comment for "Prime-ng Confirm Dialog: Hide The Button After Confirmation"