Getting Started
Ngx-Confirm - alerts, confirms and dialogs in one.
The quickest way to build modals with angular ngx-confirm manages the scope, you don't need to worry about anything, so that you can throw in a template and render stuff right away.
Authors
Installation
Install @nikiphoros/ngx-confirm with npm command
npm install @nikiphoros/ngx-confirm
Add needed package to NgModule imports:
import { NgxConfirmModule } from '@nikiphoros/ngx-confirm';
@NgModule({
...
imports: [NgxConfirmModule,...]
...
})
Usage
After importing NgxConfirmModule module in your app, use a component in your html:
<button (click)="openAlert()" class="btn">Open Alert Box</button>
And in component.ts file
import { Component } from '@angular/core';
import { NgxConfirmUiService } from '@nikiphoros/ngx-confirm/src/lib/ngx-confirm.service';
import { transition,types } from '@nikiphoros/ngx-confirm/src/lib/components/alert/alert';
export class AppComponent() {
constructor(private NgxConfirm: NgxConfirmUiService) {}
openAlert() {
this.NgxConfirm.open({
title: 'Alert Box',
type: types.primary,
text: 'Text here',
backDrop: true,
largeWidth: true,
transition: transition.na,
buttons: [
{ text: 'OK', btnClass:"xyz" },
{ text: 'Submit'}
],
}).subscribe((suc) => {
console.log(suc);
});
}
}