fix(angular): lint issue

This commit is contained in:
Manu Mtz.-Almeida
2018-12-13 16:43:04 +01:00
parent b6aea08be4
commit a961dca7e8
2 changed files with 12 additions and 7 deletions

View File

@ -59,13 +59,11 @@ export class IonTabs {
@HostListener('ionTabButtonClick', ['$event.detail']) @HostListener('ionTabButtonClick', ['$event.detail'])
onTabButtonClick(detail: TabButtonClickDetail) { onTabButtonClick(detail: TabButtonClickDetail) {
const { tab, selected } = detail; const { tab, selected } = detail;
if (tab) { const href = `${this.outlet.tabsPrefix}/${tab}`;
const href = `${this.outlet.tabsPrefix}/${tab}`; const url = selected
const url = selected ? href
? href : this.outlet.getLastUrl(tab) || href;
: this.outlet.getLastUrl(tab) || href;
this.navCtrl.navigateBack(url, true); this.navCtrl.navigateBack(url, true);
}
} }
} }

View File

@ -77,6 +77,9 @@ export class TabButton implements ComponentInterface {
if (this.layout === undefined) { if (this.layout === undefined) {
this.layout = this.config.get('tabButtonLayout', 'icon-top'); this.layout = this.config.get('tabButtonLayout', 'icon-top');
} }
if (isNotDefined(this.tab)) {
console.error('Missing "tab" property in <ion-tab-button>');
}
} }
private get hasLabel() { private get hasLabel() {
@ -117,3 +120,7 @@ export class TabButton implements ComponentInterface {
); );
} }
} }
function isNotDefined(a: any) {
return a == null;
}