@@ -12,6 +12,8 @@ import {
12
12
import { AppBarTabComponent } from '../app-bar-tab/app-bar-tab.component' ;
13
13
import { Router } from '@angular/router' ;
14
14
import { AppBarTitleLayout , AppBarFabPosition } from '../interfaces' ;
15
+ import { IonTabs } from '@ionic/angular' ;
16
+ import { TabButtonClickDetail } from '@ionic/core' ;
15
17
16
18
@Component ( {
17
19
selector : 'fiv-app-bar' ,
@@ -31,10 +33,11 @@ export class AppBarComponent implements OnInit, AfterViewInit, AfterContentInit
31
33
32
34
@ViewChild ( 'fab' ) fab : LoadingFabComponent ;
33
35
@Input ( ) icon = 'md-add' ;
36
+ @Input ( ) tabs : IonTabs ;
34
37
@Input ( ) titleLayout : AppBarTitleLayout = 'hide' ;
35
38
@Output ( ) fivFabClick = new EventEmitter < AppBarComponent > ( ) ;
36
39
37
- @ContentChildren ( AppBarTabComponent ) tabs : QueryList < AppBarTabComponent > ;
40
+ @ContentChildren ( AppBarTabComponent ) tabComponents : QueryList < AppBarTabComponent > ;
38
41
39
42
@Input ( )
40
43
set position ( position : AppBarFabPosition ) {
@@ -118,14 +121,14 @@ export class AppBarComponent implements OnInit, AfterViewInit, AfterContentInit
118
121
119
122
private prepareTabs ( position : AppBarFabPosition ) {
120
123
if ( position === 'center' ) {
121
- this . tabsLeft = this . tabs . toArray ( ) . slice ( 0 , 2 ) ;
122
- this . tabsRight = this . tabs . toArray ( ) . slice ( 2 , 4 ) ;
124
+ this . tabsLeft = this . tabComponents . toArray ( ) . slice ( 0 , 2 ) ;
125
+ this . tabsRight = this . tabComponents . toArray ( ) . slice ( 2 , 4 ) ;
123
126
} else if ( position === 'right' ) {
124
- this . tabsLeft = this . tabs . toArray ( ) ;
127
+ this . tabsLeft = this . tabComponents . toArray ( ) ;
125
128
this . tabsRight = [ ] ;
126
129
} else if ( position === 'left' ) {
127
130
this . tabsLeft = [ ] ;
128
- this . tabsRight = this . tabs . toArray ( ) ;
131
+ this . tabsRight = this . tabComponents . toArray ( ) ;
129
132
}
130
133
}
131
134
@@ -145,4 +148,8 @@ export class AppBarComponent implements OnInit, AfterViewInit, AfterContentInit
145
148
fabClick ( ) {
146
149
this . fivFabClick . emit ( this ) ;
147
150
}
151
+
152
+ ionTabButtonClick ( event : TabButtonClickDetail ) {
153
+ this . tabs . onTabButtonClick ( event ) ;
154
+ }
148
155
}
0 commit comments