From 6e1ae9710e5386217f42ffcd6294c8617fc5f8e9 Mon Sep 17 00:00:00 2001 From: "Manu Mtz.-Almeida" Date: Mon, 27 Feb 2017 19:07:16 +0100 Subject: [PATCH] refactor(Tabs): moves markup to TabButton component --- src/components/tabs/tab-button.ts | 13 ++++++++++--- src/components/tabs/tabs.ts | 7 +------ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/components/tabs/tab-button.ts b/src/components/tabs/tab-button.ts index 7ef63750f6..fe33a89e12 100644 --- a/src/components/tabs/tab-button.ts +++ b/src/components/tabs/tab-button.ts @@ -1,4 +1,4 @@ -import { Directive, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, Renderer } from '@angular/core'; +import { Component, ElementRef, EventEmitter, HostListener, Input, OnInit, Output, Renderer } from '@angular/core'; import { Config } from '../../config/config'; import { Ion } from '../ion'; @@ -7,8 +7,13 @@ import { Tab } from './tab'; /** * @private */ -@Directive({ +@Component({ selector: '.tab-button', + template: + '' + + '{{tab.tabTitle}}' + + '{{tab.tabBadge}}' + + '
', host: { '[attr.id]': 'tab._btnId', '[attr.aria-controls]': 'tab._tabId', @@ -18,7 +23,9 @@ import { Tab } from './tab'; '[class.has-title-only]': 'hasTitleOnly', '[class.icon-only]': 'hasIconOnly', '[class.has-badge]': 'hasBadge', - '[class.disable-hover]': 'disHover' + '[class.disable-hover]': 'disHover', + '[class.tab-disabled]': '!tab.enabled', + '[class.tab-hidden]': '!tab.show', } }) export class TabButton extends Ion implements OnInit { diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index 0c2ef9c05f..5209c518fd 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -150,12 +150,7 @@ import { ViewController } from '../../navigation/view-controller'; selector: 'ion-tabs', template: '
' + - '' + - '' + - '{{t.tabTitle}}' + - '{{t.tabBadge}}' + - '
' + - '
' + + '' + '
' + '
' + '' +