@@ -12,7 +12,7 @@ import {NavController} from '../nav/nav-controller';
12
12
import { ViewController } from '../nav/view-controller' ;
13
13
import { Icon } from '../icon/icon' ;
14
14
import { rafFrames } from '../../util/dom' ;
15
- import { isUndefined } from '../../util/util' ;
15
+ import { isUndefined , isTrueProperty } from '../../util/util' ;
16
16
17
17
18
18
/**
@@ -69,6 +69,7 @@ import {isUndefined} from '../../util/util';
69
69
} )
70
70
export class Tabs extends Ion {
71
71
private _ids : number = - 1 ;
72
+ private _preloadTabs : boolean = null ;
72
73
private _tabs : Array < Tab > = [ ] ;
73
74
private _onReady = null ;
74
75
private _useHighlight : boolean ;
@@ -150,11 +151,8 @@ export class Tabs extends Ion {
150
151
* @private
151
152
*/
152
153
ngAfterViewInit ( ) {
153
- this . preloadTabs = ( this . preloadTabs !== "false" && this . preloadTabs !== false ) ;
154
-
155
154
this . _setConfig ( 'tabbarPlacement' , 'bottom' ) ;
156
155
this . _setConfig ( 'tabbarIcons' , 'top' ) ;
157
- this . _setConfig ( 'preloadTabs' , false ) ;
158
156
159
157
if ( this . _useHighlight ) {
160
158
this . _platform . onResize ( ( ) => {
@@ -167,14 +165,18 @@ export class Tabs extends Ion {
167
165
this . select ( tab ) ;
168
166
} ) ;
169
167
} ) ;
168
+ }
170
169
170
+ ngAfterContentInit ( ) {
171
171
let selectedIndex = this . selectedIndex ? parseInt ( this . selectedIndex , 10 ) : 0 ;
172
172
173
+ let preloadTabs = ( isUndefined ( this . preloadTabs ) ? this . _config . getBoolean ( 'preloadTabs' ) : isTrueProperty ( this . preloadTabs ) ) ;
174
+
173
175
this . _tabs . forEach ( ( tab , index ) => {
174
176
if ( index === selectedIndex ) {
175
177
this . select ( tab ) ;
176
178
177
- } else if ( this . preloadTabs ) {
179
+ } else if ( preloadTabs ) {
178
180
tab . preload ( 1000 * index ) ;
179
181
}
180
182
} ) ;
@@ -215,7 +217,7 @@ export class Tabs extends Ion {
215
217
return this . _touchActive ( selectedTab ) ;
216
218
}
217
219
218
- console . time ( 'Tabs#select ' + selectedTab . id ) ;
220
+ console . debug ( 'Tabs, select' , selectedTab . id ) ;
219
221
220
222
let opts = {
221
223
animate : false
@@ -257,7 +259,6 @@ export class Tabs extends Ion {
257
259
this . _onReady = null ;
258
260
}
259
261
260
- console . time ( 'Tabs#select ' + selectedTab . id ) ;
261
262
} ) ;
262
263
}
263
264
0 commit comments