$ npm i --global @voxtecnologia/alert
$ npm i --save @voxtecnologia/alert
Import VoxAlertModule or VoxAlertConfirmModule into your app.module.
import { VoxAlertModule, VoxAlertConfirmModule } from '@voxtecnologia/alert';
@NgModule({
...
imports: [
VoxAlertModule,
VoxAlertConfirmModule
],
})
Import VoxAlertService or VoxAlertConfirmService into your app.component
import { Component } from '@angular/core';
import { VoxAlertService, VoxAlertConfirmService } from '@voxtecnologia/alert';
import { EventEmitterService } from '@voxtecnologia/alert';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
public title = 'app';
constructor(
private alertService: VoxAlertService,
private confirmService: VoxAlertConfirmService
) {
EventEmitterService.get('confirm').subscribe(data => console.log(data));
EventEmitterService.get('close').subscribe(data => console.log(data));
}
open() {
this.alertService.openModal('message', 'title', 'alert');
}
confirm() {
this.confirmService.openModalConfirme('message', 'title', 'alert', 'size');
}
}
Place the app-alert or app-vox-alert-confirm selector at the bottom of your app.component.html
<button type="button" class="btn btn-info" (click)="open()">Alert</button>
<button type="button" class="btn btn-danger" (click)="confirm()">confirm</button>
<app-alert></app-alert>
<app-vox-alert-confirm
ok="teste confirm"
close="texto close">
</app-vox-alert-confirm>
The following message types are avialable. The typess below represent the Bootstrap alert classes.
- success
- info
- warning
- danger
Alert Types | openModalConfirme | Type | Exemples | Optional | Options Default |
---|---|---|---|---|---|
success | message | string |
txt |
Yes | No |
info | title | string |
txt |
Yes | No |
warning | alert | string |
`success | info | |
danger | size | string |
`sm | lg` |