1
- import { Component , ViewChild , ViewContainerRef , ComponentResolver } from '@angular/core' ;
2
- import { Renderer , ElementRef } from '@angular/core' ;
1
+ import { Component , ComponentResolver , ElementRef , HostListener , Renderer , ViewChild , ViewContainerRef } from '@angular/core' ;
3
2
4
3
import { addSelector } from '../../config/bootstrap' ;
5
4
import { Animation } from '../../animations/animation' ;
6
5
import { Transition , TransitionOptions } from '../../transitions/transition' ;
7
6
import { Config } from '../../config/config' ;
8
7
import { NavParams } from '../nav/nav-params' ;
9
8
import { Platform } from '../../platform/platform' ;
9
+ import { Key } from '../../util/key' ;
10
10
import { isPresent , isUndefined , isDefined } from '../../util/util' ;
11
11
import { nativeRaf , CSS } from '../../util/dom' ;
12
12
import { ViewController } from '../nav/view-controller' ;
@@ -204,7 +204,7 @@ class PopoverCmp {
204
204
} ) ;
205
205
}
206
206
207
- ionViewDidEnter ( ) {
207
+ ngAfterViewInit ( ) {
208
208
let activeElement : any = document . activeElement ;
209
209
if ( document . activeElement ) {
210
210
activeElement . blur ( ) ;
@@ -226,6 +226,13 @@ class PopoverCmp {
226
226
this . dismiss ( 'backdrop' ) ;
227
227
}
228
228
}
229
+
230
+ @HostListener ( 'body:keyup' , [ '$event' ] )
231
+ private _keyUp ( ev : KeyboardEvent ) {
232
+ if ( this . enabled && this . _viewCtrl . isLast ( ) && ev . keyCode === Key . ESCAPE ) {
233
+ this . bdClick ( ) ;
234
+ }
235
+ }
229
236
}
230
237
231
238
export interface PopoverOptions {
0 commit comments