mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 12:29:55 +08:00
feat(tabs): add change event
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
import {Directive, ElementRef, Optional, Host, forwardRef, ViewContainerRef, HostListener} from 'angular2/core';
|
||||
import {EventEmitter, Output} from 'angular2/core';
|
||||
import {NgFor, NgIf} from 'angular2/common';
|
||||
|
||||
import {Ion} from '../ion';
|
||||
@ -68,6 +69,8 @@ import {rafFrames} from '../../util/dom';
|
||||
]
|
||||
})
|
||||
export class Tabs extends Ion {
|
||||
@Output() change: EventEmitter<any> = new EventEmitter();
|
||||
|
||||
/**
|
||||
* Hi, I'm "Tabs". I'm really just another Page, with a few special features.
|
||||
* "Tabs" can be a sibling to other pages that can be navigated to, which those
|
||||
@ -163,6 +166,7 @@ export class Tabs extends Ion {
|
||||
selectedTab.load(opts, () => {
|
||||
|
||||
selectedTab.emitSelect();
|
||||
this.change.emit(selectedTab);
|
||||
|
||||
if (selectedTab.root) {
|
||||
// only show the selectedTab if it has a root
|
||||
|
@ -63,6 +63,10 @@ class TabsPage {
|
||||
console.log('Chat clicked!');
|
||||
this.modal.open(ChatPage);
|
||||
}
|
||||
|
||||
onTabChange() {
|
||||
console.log('onTabChange');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
<ion-tabs preloadTabs="false">
|
||||
<ion-tabs preloadTabs="false" (change)="onTabChange()">
|
||||
<ion-tab tabTitle="Recents" tabIcon="call" [root]="tab1Root"></ion-tab>
|
||||
<ion-tab tabTitle="Favorites" tabIcon="star" [root]="tab2Root"></ion-tab>
|
||||
<ion-tab tabTitle="Settings" tabIcon="settings" [root]="tab3Root"></ion-tab>
|
||||
|
Reference in New Issue
Block a user