mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
back-button: use updated config
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import {Component, Template, Inject, Parent, NgElement} from 'angular2/angular2'
|
||||
import {ComponentConfig} from 'ionic2/config/component-config'
|
||||
import * as types from 'ionic2/components/aside/extensions/types'
|
||||
import * as gestures from 'ionic2/components/aside/extensions/gestures';
|
||||
import {IonicComponent} from 'ionic2/config/component'
|
||||
@@ -58,15 +57,26 @@ export class Aside {
|
||||
}
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'ion-aside',
|
||||
bind: {
|
||||
content: 'content',
|
||||
side: 'side',
|
||||
dragThreshold: 'dragThreshold'
|
||||
}
|
||||
})
|
||||
|
||||
new IonicComponent(Aside, {
|
||||
bind: {
|
||||
side: {
|
||||
default: 'left'
|
||||
value: 'left'
|
||||
},
|
||||
type: {
|
||||
ios: 'reveal',
|
||||
android: 'overlay',
|
||||
default: 'overlay',
|
||||
defaults: {
|
||||
ios: 'reveal',
|
||||
android: 'overlay',
|
||||
base: 'overlay',
|
||||
}
|
||||
},
|
||||
dragThreshold: {},
|
||||
content: {},
|
||||
|
||||
@@ -1,32 +1,37 @@
|
||||
import {NgElement, Component, Template} from 'angular2/angular2'
|
||||
import {ComponentConfig} from 'ionic2/config/component-config'
|
||||
|
||||
export let BackButtonConfig = new ComponentConfig('back-button')
|
||||
|
||||
BackButtonConfig
|
||||
.platform('ios', instance => {
|
||||
instance.domElement.querySelector('.back-button-icon').classList.add('ion-ios-arrow-back')
|
||||
instance.domElement.querySelector('.back-default').textContent = 'Back'
|
||||
})
|
||||
.platform('android', instance => {
|
||||
instance.domElement.querySelector('.back-button-icon').classList.add('ion-android-arrow-back')
|
||||
})
|
||||
import {IonicComponent} from 'ionic2/config/component'
|
||||
|
||||
@Component({
|
||||
selector: '.back-button',
|
||||
services: [BackButtonConfig]
|
||||
})
|
||||
@Template({
|
||||
inline: `
|
||||
<icon class="back-button-icon"></icon>
|
||||
<icon [class-name]="'back-button-icon ' + icon"></icon>
|
||||
<div class="back-button-text">
|
||||
<div class="back-default"></div>
|
||||
<div class="back-title"></div>
|
||||
</div>`
|
||||
})
|
||||
export class BackButton {
|
||||
constructor(@NgElement() ngEle:NgElement, configFactory: BackButtonConfig) {
|
||||
constructor(
|
||||
@NgElement() ngEle:NgElement
|
||||
) {
|
||||
this.domElement = ngEle.domElement
|
||||
this.config = configFactory.create(this);
|
||||
|
||||
setTimeout(() => {
|
||||
this.config = BackButton.config.invoke(this)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
new IonicComponent(BackButton, {
|
||||
bind: {
|
||||
icon: {
|
||||
defaults: {
|
||||
ios: 'ion-ios-arrow-back',
|
||||
android: 'ion-android-arrow-back',
|
||||
base: 'ion-chevron-left'
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user