set view transition by config

This commit is contained in:
Adam Bradley
2015-06-28 22:13:45 -05:00
parent d763e39186
commit 95953e4be9
5 changed files with 19 additions and 9 deletions

View File

@ -152,7 +152,7 @@ export function ionicBootstrap(ComponentType, config) {
config.setPlatform(Platform); config.setPlatform(Platform);
// make the config global // make the config global
GlobalIonicConfig = config; IonicConfig.setGlobal(config);
// config and platform settings have been figured out // config and platform settings have been figured out
// apply the correct CSS to the app // apply the correct CSS to the app
@ -196,5 +196,3 @@ export function load(app) {
app.main(ionicBootstrap); app.main(ionicBootstrap);
} }
} }
export let GlobalIonicConfig = null;

View File

@ -3,7 +3,7 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotatio
import {View} from 'angular2/src/core/annotations_impl/view'; import {View} from 'angular2/src/core/annotations_impl/view';
import * as util from 'ionic/util'; import * as util from 'ionic/util';
import {GlobalIonicConfig} from '../components/app/app'; import {IonicConfig} from './config';
import { import {
Aside, Content, Refresher, Aside, Content, Refresher,
Slides, Slide, SlidePager, Slides, Slide, SlidePager,
@ -100,9 +100,9 @@ function appendModeConfig(ComponentType) {
} }
// get the property values from a global user/platform config // get the property values from a global user/platform config
let configVal = GlobalIonicConfig.setting(prop); let configVal = IonicConfig.global.setting(prop);
if (configVal) { if (configVal) {
instance[prop] = globalPropertyValue; instance[prop] = configVal;
continue; continue;
} }
@ -129,7 +129,7 @@ function appendModeConfig(ComponentType) {
} }
if (!platformMode) { if (!platformMode) {
platformMode = GlobalIonicConfig.setting('mode'); platformMode = IonicConfig.global.setting('mode');
} }
let id = config.classId || (config.selector && config.selector.replace('ion-', '')); let id = config.classId || (config.selector && config.selector.replace('ion-', ''));

View File

@ -12,7 +12,7 @@ export class IonicConfig {
// override defaults w/ user config // override defaults w/ user config
if (settings) { if (settings) {
extend(this._settings, setting); extend(this._settings, settings);
} }
} }
@ -125,4 +125,14 @@ export class IonicConfig {
this._settings.platforms = extend(platform.settings(), this._settings.platforms || {}); this._settings.platforms = extend(platform.settings(), this._settings.platforms || {});
} }
static setGlobal(config) {
globalConfig = config;
}
static get global() {
return globalConfig;
}
} }
export let globalConfig = null;

View File

@ -70,6 +70,7 @@ Platform.register({
], ],
settings: { settings: {
mode: 'ios', mode: 'ios',
viewTransition: 'ios',
tapPolyfill: true tapPolyfill: true
}, },
isMatch(p) { isMatch(p) {

View File

@ -1,4 +1,5 @@
import {Animation} from '../animations/animation'; import {Animation} from '../animations/animation';
import {IonicConfig} from '../config/config';
const SHOW_NAVBAR_CSS = 'show-navbar'; const SHOW_NAVBAR_CSS = 'show-navbar';
const SHOW_VIEW_CSS = 'show-view'; const SHOW_VIEW_CSS = 'show-view';
@ -84,7 +85,7 @@ export class Transition extends Animation {
STATIC CLASSES STATIC CLASSES
*/ */
static create(nav, opts = {}) { static create(nav, opts = {}) {
const name = opts.animation || 'ios'; const name = opts.animation || IonicConfig.global.setting('viewTransition');
let TransitionClass = TransitionRegistry[name]; let TransitionClass = TransitionRegistry[name];
if (!TransitionClass) { if (!TransitionClass) {