mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
docs(demos): set tabbar color dynamically
This commit is contained in:
@ -18,7 +18,10 @@ import * as tabs from './tabs/tabs';
|
||||
|
||||
|
||||
@Directive({
|
||||
selector: '.android-attr',
|
||||
selector: '[android-attr]',
|
||||
defaultInputs: {
|
||||
'androidAttr': 'primary'
|
||||
},
|
||||
})
|
||||
export class AndroidAttribute {
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page, ViewController} from 'ionic/ionic';
|
||||
import {Page, ViewController, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
@Page({
|
||||
template: '' +
|
||||
'<ion-navbar *navbar hide-back-button class="android-attr">' +
|
||||
'<ion-navbar *navbar hide-back-button [attr.primary]="isAndroid ? \'\' : null">' +
|
||||
'<ion-title>Tabs</ion-title>' +
|
||||
'</ion-navbar>' +
|
||||
'<ion-content>' +
|
||||
@ -14,7 +14,9 @@ import * as helpers from '../../helpers';
|
||||
directives: [forwardRef(() => helpers.AndroidAttribute)],
|
||||
})
|
||||
class TabTextPage {
|
||||
constructor() {
|
||||
constructor(platform: Platform) {
|
||||
this.platform = platform;
|
||||
this.isAndroid = platform.is('android');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,30 +1,32 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page, ViewController} from 'ionic/ionic';
|
||||
import {Page, ViewController, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
@Page({
|
||||
template: '' +
|
||||
'<ion-navbar *navbar hide-back-button class="android-attr">' +
|
||||
'<ion-title>Tabs</ion-title>' +
|
||||
'<ion-navbar *navbar hide-back-button [attr.royal]="isAndroid ? \'\' : null">' +
|
||||
'<ion-title>Tabs</ion-title>' +
|
||||
'</ion-navbar>' +
|
||||
'<ion-content>' +
|
||||
'</ion-content>',
|
||||
directives: [forwardRef(() => helpers.AndroidAttribute)],
|
||||
})
|
||||
class TabIconTextPage {
|
||||
constructor() {
|
||||
constructor(platform: Platform) {
|
||||
this.platform = platform;
|
||||
this.isAndroid = platform.is('android');
|
||||
}
|
||||
}
|
||||
|
||||
@Page({
|
||||
template:
|
||||
'<ion-tabs class="tabs-icon-text">' +
|
||||
'<ion-tab tab-icon="water" tab-title="Water" [root]="tabOne"></ion-tab>' +
|
||||
'<ion-tab tab-icon="leaf" tab-title="Life" [root]="tabTwo"></ion-tab>' +
|
||||
'<ion-tab tab-icon="flame" tab-title="Fire" [root]="tabThree"></ion-tab>' +
|
||||
'<ion-tab tab-icon="magnet" tab-title="Force" [root]="tabFour"></ion-tab>' +
|
||||
'<ion-tab tab-icon="water" tab-title="Water" [root]="tabOne"></ion-tab>' +
|
||||
'<ion-tab tab-icon="leaf" tab-title="Life" [root]="tabTwo"></ion-tab>' +
|
||||
'<ion-tab tab-icon="flame" tab-title="Fire" [root]="tabThree"></ion-tab>' +
|
||||
'<ion-tab tab-icon="magnet" tab-title="Force" [root]="tabFour"></ion-tab>' +
|
||||
'</ion-tabs>',
|
||||
})
|
||||
export class IconTextPage {
|
||||
|
@ -1,12 +1,12 @@
|
||||
import {NavController, NavParams} from 'ionic/ionic';
|
||||
import {Page, ViewController} from 'ionic/ionic';
|
||||
import {Page, ViewController, Platform} from 'ionic/ionic';
|
||||
import {forwardRef} from 'angular2/angular2';
|
||||
import * as helpers from '../../helpers';
|
||||
|
||||
|
||||
@Page({
|
||||
template: '' +
|
||||
'<ion-navbar *navbar hide-back-button class="android-attr">' +
|
||||
'<ion-navbar *navbar hide-back-button [attr.danger]="isAndroid ? \'\' : null">' +
|
||||
'<ion-title>Tabs</ion-title>' +
|
||||
'</ion-navbar>' +
|
||||
'<ion-content>' +
|
||||
@ -14,7 +14,9 @@ import * as helpers from '../../helpers';
|
||||
directives: [forwardRef(() => helpers.AndroidAttribute)],
|
||||
})
|
||||
class TabIconPage {
|
||||
constructor() {
|
||||
constructor(platform: Platform) {
|
||||
this.platform = platform;
|
||||
this.isAndroid = platform.is('android');
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user