3 * Copyright (C) 2017-2018 "IoT.bzh"
4 * Author Sebastien Douheret <sebastien@iot.bzh>
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import { Component, OnInit, Input } from '@angular/core';
20 import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
30 selector: 'xds-confirm-modal',
33 <div class="modal-header">
37 <div class="modal-body row">
38 <div class="col-12 text-center">
39 <div [innerHtml]="question"></div>
41 <div class="col-12 text-center" style="margin-top: 2em;">
42 <button *ngIf="textBtn[0] != ''"
44 class="btn btn-md btn-primary"
46 (click)="onClick(textBtn[0])"> {{textBtn[0]}}
49 <button *ngIf="textBtn[1] != ''"
51 class="btn btn-md btn-secondary"
53 (click)="onClick(textBtn[1])"> {{textBtn[1]}}
58 <div *ngIf="footer!=''" class="modal-footer">
59 <div class="col-12 text-center">
60 <div [innerHtml]="footer"></div>
67 export class ConfirmModalComponent implements OnInit {
74 textBtn: Array<string> = ['', ''];
77 private modalRef: NgbActiveModal,
84 this.textBtn = [ 'OK', '' ];
88 this.textBtn = [ '', 'Cancel' ];
92 this.textBtn = [ 'OK', 'Cancel' ];
97 this.textBtn = [ 'Yes', 'No' ];
102 onClick(txt: string): void {
103 this.modalRef.close(txt.toLowerCase());