src/app/shared/components/confirm/confirm.component.ts
Confirm component ConfirmService
selector | app-modal-confirm |
Properties |
|
Methods |
Outputs |
constructor(bsModalRef: BsModalRef)
|
||||||||
Parameters :
|
confirm
|
$event type: EventEmitter
|
validate |
validate()
|
Returns :
void
|
Public bsModalRef |
bsModalRef:
|
Type : BsModalRef
|
Public buttonCancel |
buttonCancel:
|
Default value : Cancel
|
Public buttonConfirm |
buttonConfirm:
|
Default value : Validate
|
Public description |
description:
|
Type : string
|
Public title |
title:
|
Type : string
|
import { Component, Output, EventEmitter } from '@angular/core';
import { BsModalRef } from 'ngx-bootstrap';
/**
* Confirm component
* {@Link ConfirmService}
*
* @author Damien Vitrac
*/
@Component({
selector: 'app-modal-confirm',
template: `
<div class="modal-confirm" id="modal-confirm">
<div class="modal-body">
<h4 [innerHtml]="title"></h4>
<p [innerHtml]="description"></p>
</div>
<div class="modal-footer">
<button (click)="bsModalRef.hide()" class="btn btn-default">{{ buttonCancel }}</button>
<button (click)="validate()" class="btn btn-primary">{{ buttonConfirm }}</button>
</div>
</div>
`
})
export class ConfirmComponent {
public buttonConfirm = 'Validate';
public buttonCancel = 'Cancel';
public title: string;
public description: string;
@Output() confirm = new EventEmitter();
constructor(public bsModalRef: BsModalRef) {
}
validate() {
this.confirm.emit();
this.bsModalRef.hide();
}
}