Project

General

Profile

1
/**
2
 * Created by stefania on 5/2/17.
3
 */
4
import { Component, ViewChild, Input, Output, EventEmitter } from '@angular/core';
5
import { ModalDirective } from 'ngx-bootstrap/modal';
6

    
7
@Component({
8
    selector: 'delete-confirmation-dialog',
9
    templateUrl: './delete-confirmation-dialog.component.html'
10
})
11
export class DeleteConfirmationDialogComponent {
12

    
13
    @ViewChild('autoShownModal')
14
    public autoShownModal:ModalDirective;
15

    
16
    @Input()
17
    public isModalShown:boolean = false;
18

    
19
    @Output() emmitObject: EventEmitter<any> = new EventEmitter();
20

    
21
    private _ids: string[] = [];
22

    
23
    public set ids(ids: string[]) {
24
        this._ids = ids;
25
    }
26

    
27
    public showModal():void {
28
        this.isModalShown = true;
29
    }
30

    
31
    public hideModal():void {
32
        this.autoShownModal.hide();
33
    }
34

    
35
    public onHidden():void {
36
        this.isModalShown = false;
37
    }
38

    
39
    public confirmedAction() {
40
        this.emmitObject.emit(this._ids);
41
        this.hideModal();
42
    }
43

    
44
    // public saveCustom(obj : any) {
45
    //     if (this.type == 'topic') {
46
    //         this._faqService.saveTopic(<Topic> obj).subscribe(
47
    //             data => this.emmitObject.emit(data),
48
    //             error => this.emmitError.emit(error)
49
    //         );
50
    //     } else if (this.type == 'question') {
51
    //         return;
52
    //     }
53
    //     this.hideModal();
54
    // }
55
}
(2-2/4)