mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00

BREAKING CHANGES: Colors should be passed in the `color` input on components, not added individually as an attribute on the component. For example: ``` <ion-tabs primary> ``` Becomes ``` <ion-tabs color=”primary”> ``` Or to bind an expression to color: ``` <ion-navbar [color]="barColor"> ... </ion-navbar> ``` ```ts @Component({ templateUrl: 'build/pages/about/about.html' }) export class AboutPage { barColor: string; constructor(private nav: NavController, platform: Platform) { this.barColor = platform.is('android') ? 'primary' : 'light'; } } ``` Reason for this change: It was difficult to dynamically add colors to components, especially if the name of the color attribute was unknown in the template. This change keeps the css flat since we aren’t chaining color attributes on components and instead we assign a class to the component which includes the color’s name. This allows you to easily toggle a component between multiple colors. Speeds up performance because we are no longer reading through all of the attributes to grab the color ones. references #7467 closes #7087 closes #7401 closes #7523
78 lines
1.9 KiB
HTML
78 lines
1.9 KiB
HTML
<ion-header>
|
|
|
|
<ion-navbar>
|
|
<ion-title>Config</ion-title>
|
|
</ion-navbar>
|
|
|
|
</ion-header>
|
|
|
|
|
|
<ion-content class="config-demo">
|
|
|
|
<ion-list>
|
|
<ion-item>
|
|
<ion-label>Back Button Icon</ion-label>
|
|
<ion-select [(ngModel)]="config.backButtonIcon">
|
|
<ion-option value="ios-arrow-back">ios-arrow-back</ion-option>
|
|
<ion-option value="md-arrow-back">md-arrow-back</ion-option>
|
|
<ion-option value="close">close</ion-option>
|
|
<ion-option value="heart">heart</ion-option>
|
|
<ion-option value="globe">globe</ion-option>
|
|
</ion-select>
|
|
</ion-item>
|
|
|
|
<ion-item>
|
|
<ion-label>Icon Mode</ion-label>
|
|
<ion-select [(ngModel)]="config.iconMode">
|
|
<ion-option value="ios">ios</ion-option>
|
|
<ion-option value="md">md</ion-option>
|
|
</ion-select>
|
|
</ion-item>
|
|
|
|
<ion-item>
|
|
<ion-label>Tab Placement</ion-label>
|
|
<ion-select [(ngModel)]="config.tabsPlacement">
|
|
<ion-option value="bottom">bottom</ion-option>
|
|
<ion-option value="top">top</ion-option>
|
|
</ion-select>
|
|
</ion-item>
|
|
|
|
</ion-list>
|
|
<p class="note">Note: the config will not be updated until you click the button below.</p>
|
|
|
|
<div padding>
|
|
<button ion-button block (click)="load()">
|
|
Update Config
|
|
</button>
|
|
</div>
|
|
|
|
<p class="note">Any config for your app should be passed as the third argument to ionicBootstrap.</p>
|
|
|
|
<!-- this has to be formatted weird for pre -->
|
|
<pre margin>
|
|
ionicBootstrap(MyApp, [], {
|
|
backButtonIcon: "{{initialConfig.backButtonIcon}}"
|
|
iconMode: "{{initialConfig.iconMode}}"
|
|
tabsPlacement: "{{initialConfig.tabsPlacement}}"
|
|
});</pre>
|
|
|
|
<div padding>
|
|
<button ion-button block color="secondary" (click)="push()">
|
|
Go to Another Page
|
|
</button>
|
|
</div>
|
|
|
|
</ion-content>
|
|
|
|
<style>
|
|
.config-demo pre {
|
|
background-color: #f8f8f8;
|
|
}
|
|
|
|
.config-demo .note {
|
|
color: #444;
|
|
font-style: italic;
|
|
margin: 0 16px;
|
|
}
|
|
</style>
|