@ddiazr/alert-service
v0.0.1
Published
Servicio de alertas de sweetalert2
Downloads
110
Readme
Alert Service
Service generico donde ya no necesitas hacer los alert mas comunes
Instalación
npm install @ddiazr/alert-servicePeer Dependencies
npm i sweetalert2Uso básico
import { AlertService } from '@ddiazr/alert-service';
@Component({
imports: [],
template: `
<div class="row">
<div class="col-md-1">
<button class="btn btn-info" (click)="basic()">BASIC</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="basic2()">BASIC 2</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="question()">Question</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="question2()">Question 2</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="text()">Text</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="toast1()">Toast1</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="toast2()">Toast2</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="toast3()">Toast3</button>
</div>
<div class="col-md-1">
<button class="btn btn-info" (click)="toast4()">Toast4</button>
</div>
</div>
`,
})
export class AppComponent {
private alertService = inject(AlertService);
//algunas funciones mas comunes a utilizar
basic() {
this.alertService.basicAlert('Prueba');
}
basic2() {
this.alertService.basicAlert('Prueba', 'error');
}
question() {
this.alertService.Questions('Seguro de hacer x action');
}
question2() {
this.alertService.Questions('Seguro de hacer x action', 'question');
}
text() {
this.alertService.Textarea('Ingrese Nombre');
}
toast1() {
this.alertService.toast('Info. One');
}
toast2() {
this.alertService.toast('Info. Two', 'warning');
}
toast3() {
this.alertService.toast('Info. Three', 'error', 'bottom-right');
}
toast4() {
this.alertService.toast('Info. Four', 'success', 'bottom-start');
}
}Licencia
MIT
Source files
src/ .ts !.d.ts
