wip: android navbar color directive

This commit is contained in:
Drew Rygh
2015-10-18 11:27:11 -05:00
parent 3281d84718
commit 705d32aae2
3 changed files with 19 additions and 3 deletions

View File

@ -1,9 +1,9 @@
<ion-navbar *navbar class="show-navbar">
<ion-navbar *navbar class="android-attr">
<ion-title>Action Sheet</ion-title>
</ion-navbar>
<ion-content padding class="has-header components-demo">
<button block (click)="openMenu()">
<button block (click)="openMenu()" class="android-attr">
Show Actionsheet
</button>
</ion-content>

View File

@ -1,3 +1,7 @@
import {Directive, ElementRef, Renderer} from 'angular2/angular2';
import {Platform, Navbar} from 'ionic/ionic';
import {ActionSheetPage} from './actionSheet/actionSheet';
import {ButtonsPage,
@ -30,6 +34,17 @@ import {PopupsPage} from './popups/popups';
import {SlidesPage} from './slides/slides';
import {TabsPage} from './tabs/tabs';
@Directive({
selector: '.android-attr',
})
export class AndroidAttribute {
constructor (platform: Platform, elementRef: ElementRef, renderer: Renderer) {
this.isAndroid = platform.is('android');
renderer.setElementAttribute(elementRef, 'primary', this.isAndroid ? true : null);
}
}
export function toTitleCase(str) {
return str.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});

View File

@ -5,7 +5,8 @@ import * as helpers from './helpers';
@App({
template: '<ion-nav id="nav" [root]="rootPage"></ion-nav><ion-overlay></ion-overlay>'
template: '<ion-nav id="nav" [root]="rootPage"></ion-nav><ion-overlay></ion-overlay>',
directives: [helpers.AndroidAttribute],
})
class DemoApp {