1.0.6 • Published 5 years ago
@tgawhale/confirm-box v1.0.6
ConfirmBox
Its displays a beautiful confirm box with minimal code.
It's developed using Angular 10

How to install
npm install @tgawhale/confirm-box
Steps
- Install by running
npm install @tgawhale/confirm-box; - Import
ConfirmBoxModulein your angular module;
import { ConfirmBoxModule } from 'confirm-box';
@NgModule({
....
imports: [ConfirmBoxModule, ....],
....
....
})- Declare
<confirm-box></confirm-box>at below of your root component. - Create a
ConfirmBoxServiceobject in constructor of your component. - Use the following method to show dailog
show(title , description , (val)=>{ //your code after clicked on confirm button }Example
1. app.module.ts
import { ConfirmBoxModule } from 'confirm-box';
@NgModule({
....
imports: [ConfirmBoxModule, ....],
....
....
})2. app.component.html
<button (click)="openConfirmBox()">Open</button>
<confirm-box></confirm-box>3. app.component.html
import { ConfirmBoxService } from 'confirm-box';
constructor(private cbService: ConfirmBoxService) {}
openConfirmBox() {
this.cbService.show('The item will be deleted', 'The current selected item will be deleted. The process is irreversible.', (val) => {
alert(val);
});
}