54 lines
1.3 KiB
TypeScript
54 lines
1.3 KiB
TypeScript
import {Component, ViewEncapsulation, ComponentRef, DynamicComponentLoader,ElementRef, Input, EventEmitter, Output} from '@angular/core';
|
|
import {Open} from './open.component';
|
|
|
|
@Component({
|
|
selector: 'loading',
|
|
template: `
|
|
<div class="modal fade" [open]="!isOpen" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
|
<div class="modal-dialog" role="">
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-body">
|
|
<div >
|
|
<h3 class="text-center" >{{message}}</h3>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`,
|
|
providers: [],
|
|
directives: [Open],
|
|
encapsulation: ViewEncapsulation.None,
|
|
pipes: []
|
|
})
|
|
/**
|
|
* API to an open alert window.
|
|
*/
|
|
export class Loading{
|
|
|
|
@Input() public message:string ="Loading";
|
|
|
|
/**
|
|
* if the value is true alert will be visible or else it will be hidden.
|
|
*/
|
|
public isOpen:boolean=false;
|
|
/**
|
|
* Emitted when a ok button was clicked
|
|
* or when Ok method is called.
|
|
*/
|
|
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
|
constructor(public dcl:DynamicComponentLoader, public _elementRef: ElementRef){}
|
|
/**
|
|
* Opens a alert window creating backdrop.
|
|
*/
|
|
open(){
|
|
this.isOpen= true;
|
|
}
|
|
|
|
close(){
|
|
this.isOpen = false;
|
|
}
|
|
}
|