1
|
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
|
2
|
|
3
|
@Component({
|
4
|
selector: 'modal-loading',
|
5
|
template: `
|
6
|
<div class="modal fade" [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
7
|
<div class="modal-dialog" role="">
|
8
|
<div class="modal-content">
|
9
|
|
10
|
<div class="modal-body">
|
11
|
<div >
|
12
|
<h3 class="text-center" >{{message}}</h3>
|
13
|
</div>
|
14
|
</div>
|
15
|
|
16
|
</div>
|
17
|
</div>
|
18
|
</div>
|
19
|
`,
|
20
|
encapsulation: ViewEncapsulation.None,
|
21
|
})
|
22
|
/**
|
23
|
* API to an open alert window.
|
24
|
*/
|
25
|
export class ModalLoading{
|
26
|
|
27
|
@Input() public message:string ="Loading";
|
28
|
|
29
|
/**
|
30
|
* if the value is true alert will be visible or else it will be hidden.
|
31
|
*/
|
32
|
public isOpen:boolean=false;
|
33
|
/**
|
34
|
* Emitted when a ok button was clicked
|
35
|
* or when Ok method is called.
|
36
|
*/
|
37
|
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
38
|
constructor( public _elementRef: ElementRef){}
|
39
|
/**
|
40
|
* Opens a alert window creating backdrop.
|
41
|
*/
|
42
|
open(){
|
43
|
this.isOpen= true;
|
44
|
}
|
45
|
|
46
|
close(){
|
47
|
this.isOpen = false;
|
48
|
}
|
49
|
}
|