-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(demo): Adds Confirm Dialog Demo component
- Loading branch information
1 parent
86aa44e
commit c14e751
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
projects/ngxsmart-demo/src/app/confirm-dialog-demo/confirm-dialog-demo.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="m-5"> | ||
<primary-button label="Click to Confirm" (click)="confirm()"></primary-button> | ||
|
||
<br /> | ||
<br /> | ||
<section> | ||
<h3 class="mat-h3"> | ||
<b class="m-2">Confirm Status:</b>{{confirmStatus()}} | ||
</h3> | ||
</section> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
...art-demo/src/app/confirm-dialog-demo/confirm-dialog-demo.component.html-demo.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Component, inject, signal } from '@angular/core'; | ||
import { MatDialog } from '@angular/material/dialog'; | ||
import { ConfirmDialogComponent, PrimaryButtonComponent } from '@js-smart/ngxsmart'; | ||
|
||
@Component({ | ||
selector: 'ngxsmart-confirm-dialog-demo', | ||
standalone: true, | ||
templateUrl: './confirm-dialog-demo.component.html', | ||
styles: [``], | ||
imports: [ConfirmDialogComponent, PrimaryButtonComponent], | ||
}) | ||
export class ConfirmDialogDemoComponent { | ||
dialog = inject(MatDialog); | ||
confirmStatus = signal(''); | ||
confirm() { | ||
const ref = this.dialog.open(ConfirmDialogComponent, { | ||
data: { | ||
title: 'Confirm', | ||
message: 'Are you sure you want to do this?', | ||
}, | ||
}); | ||
|
||
// Listen for confirmation result | ||
ref.afterClosed().subscribe((status: boolean) => { | ||
if (status) { | ||
this.confirmStatus.set('Confirmed'); | ||
} else { | ||
this.confirmStatus.set('Canceled'); | ||
} | ||
}); | ||
} | ||
} |