@@ -16,33 +16,22 @@ import {
1616} from '@angular/core' ;
1717
1818import { AnimationEvent } from '../animations/animations.interface' ;
19-
2019import { removeListeners } from '../helpers' ;
2120
22- /*
23- *
24- */
21+
2522@Component ( {
2623 selector : 'mk-alert' ,
2724 templateUrl : './alert.component.html' ,
2825 styleUrls : [ './alert.component.css' ] ,
2926 changeDetection : ChangeDetectionStrategy . OnPush
3027} )
3128export class AlertComponent implements AfterViewInit , OnDestroy {
32- public dismissibleClass = 'alert-dismissible' ;
33- public isDismissible = true ;
34- public remove = false ;
35- public removed : boolean ;
36- public type = 'alert' ;
37-
38- private listeners = [ ] ;
39-
4029 @Input ( ) public backgroundColor = 'danger' ;
4130 @Input ( ) public set callout ( value : boolean ) {
4231 this . type = value ? 'callout' : 'alert' ;
4332 }
44- @Input ( ) public color : string ;
45- @Input ( ) public dismissOnTimeout : number ;
33+ @Input ( ) public color ? : string ;
34+ @Input ( ) public dismissOnTimeout ? : number ;
4635 @Input ( 'isDismissible' ) public set _isDismissible ( value : boolean ) {
4736 this . isDismissible = value ;
4837 if ( value ) {
@@ -56,27 +45,24 @@ export class AlertComponent implements AfterViewInit, OnDestroy {
5645 @Output ( ) public collapseStart = new EventEmitter ( ) ;
5746 @Output ( ) public collapseDone = new EventEmitter ( ) ;
5847
59- @ViewChild ( 'removeButtonElement' ) private removeButtonElement : ElementRef ;
60- @ViewChild ( 'containerElementRef' , { read : ViewContainerRef } ) private containerElementRef : ViewContainerRef ;
48+ @ViewChild ( 'removeButtonElement' ) private removeButtonElement ?: ElementRef ;
49+
50+ public dismissibleClass = 'alert-dismissible' ;
51+ public isDismissible = true ;
52+ public remove = false ;
53+ public removed = false ;
54+ public type = 'alert' ;
55+
56+ private listeners : ( ( ) => void ) [ ] = [ ] ;
6157
62- /**
63- * @method constructor
64- * @param changeDetectorRef [description]
65- * @param ngZone [description]
66- * @param renderer2 [description]
67- * @param viewContainerRef [description]
68- */
6958 constructor (
7059 private changeDetectorRef : ChangeDetectorRef ,
7160 private ngZone : NgZone ,
7261 private renderer2 : Renderer2 ,
7362 private viewContainerRef : ViewContainerRef
7463 ) { }
7564
76- /**
77- * @method ngOnInit
78- */
79- ngAfterViewInit ( ) {
65+ ngAfterViewInit ( ) : void {
8066 this . ngZone . runOutsideAngular ( ( ) => {
8167 if ( this . dismissOnTimeout ) {
8268 setTimeout ( ( ) => {
@@ -95,27 +81,14 @@ export class AlertComponent implements AfterViewInit, OnDestroy {
9581 } ) ;
9682 }
9783
98- /**
99- * @method ngOnDesroy
100- */
101- ngOnDestroy ( ) {
84+ ngOnDestroy ( ) : void {
10285 removeListeners ( this . listeners ) ;
10386 }
10487
105- /**
106- * [collapseStart description]
107- * @method collapseStart
108- * @param event [description]
109- */
11088 public onCollapseStart ( event : AnimationEvent ) : void {
11189 this . collapseStart . emit ( event ) ;
11290 }
11391
114- /**
115- * [collapseDone description]
116- * @method collapseDone
117- * @param event [description]
118- */
11992 public onCollapseDone ( event : AnimationEvent ) : void {
12093 if ( event . toState === '1' ) {
12194 this . listeners = removeListeners ( this . listeners ) ;
0 commit comments