mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
wip: android navbar color directive
This commit is contained in:
@ -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>
|
||||
|
@ -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();});
|
||||
|
@ -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 {
|
||||
|
||||
|
Reference in New Issue
Block a user