File tree Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Expand file tree Collapse file tree 1 file changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ import {Title} from 'angular2/platform/browser';
3
3
4
4
import { Config } from '../../config/config' ;
5
5
import { ClickBlock } from '../../util/click-block' ;
6
- import { Nav } from '../nav/nav' ;
7
- import { Tabs } from '../tabs/tabs' ;
6
+ import { Platform } from '../../platform/platform' ;
8
7
9
8
10
9
/**
@@ -23,8 +22,20 @@ export class IonicApp {
23
22
24
23
constructor (
25
24
private _config : Config ,
26
- private _clickBlock : ClickBlock
27
- ) { }
25
+ private _clickBlock : ClickBlock ,
26
+ platform : Platform
27
+ ) {
28
+ platform . backButton . subscribe ( ( ) => {
29
+ let activeNav = this . getActiveNav ( ) ;
30
+ if ( activeNav ) {
31
+ if ( activeNav . length ( ) === 1 ) {
32
+ platform . exitApp ( ) ;
33
+ } else {
34
+ activeNav . pop ( ) ;
35
+ }
36
+ }
37
+ } ) ;
38
+ }
28
39
29
40
/**
30
41
* Sets the document title.
@@ -102,7 +113,7 @@ export class IonicApp {
102
113
/**
103
114
* @private
104
115
*/
105
- getActiveNav ( ) : Nav | Tabs {
116
+ getActiveNav ( ) : any {
106
117
var nav = this . _rootNav || null ;
107
118
var activeChildNav ;
108
119
You can’t perform that action at this time.
0 commit comments