diff --git a/demos/src/config/app.module.ts b/demos/src/config/app.module.ts index ea362ad7993..708f3d9d689 100644 --- a/demos/src/config/app.module.ts +++ b/demos/src/config/app.module.ts @@ -1,5 +1,5 @@ import { Component, NgModule } from '@angular/core'; -import { IonicApp, IonicModule, Platform, NavController } from '../../ionic-angular'; +import { Config, IonicApp, IonicModule, Platform, NavController } from '../../ionic-angular'; if (!window.localStorage) { Object.defineProperty(window, 'localStorage', new (function () { @@ -86,34 +86,11 @@ export class TabPage { export class ApiDemoPage { config: any; initialConfig: any; - - constructor(public platform: Platform, public navCtrl: NavController) { - - if (window.localStorage.getItem('configDemo') !== null) { - this.config = JSON.parse(window.localStorage.getItem('configDemo')); - } else if (platform.is('ios')) { - this.config = { - 'backButtonIcon': 'ios-arrow-back', - 'iconMode': 'ios', - 'tabsPlacement': 'bottom' - }; - } else if (platform.is('windows')) { - this.config = { - 'backButtonIcon': 'ios-arrow-back', - 'iconMode': 'ios', - 'tabsPlacement': 'top' - }; - } else { - this.config = { - 'backButtonIcon': 'md-arrow-back', - 'iconMode': 'md', - 'tabsPlacement': 'bottom' - }; - } - - this.initialConfig = JSON.parse(JSON.stringify(this.config)); + constructor(_config: Config, public navCtrl: NavController) { + this.config = _config.settings(); } + load() { window.localStorage.setItem('configDemo', JSON.stringify(this.config)); window.location.reload(); @@ -140,7 +117,36 @@ export class PushPage { template: '' }) export class ApiDemoApp { + config: any; root = TabPage; + constructor(public _config: Config, public platform: Platform) { + + if (window.localStorage.getItem('configDemo') !== null) { + this.config = JSON.parse(window.localStorage.getItem('configDemo')); + } else if (platform.is('ios')) { + this.config = { + 'backButtonIcon': 'ios-arrow-back', + 'iconMode': 'ios', + 'tabsPlacement': 'bottom' + }; + } else if (platform.is('windows')) { + this.config = { + 'backButtonIcon': 'ios-arrow-back', + 'iconMode': 'ios', + 'tabsPlacement': 'top' + }; + } else { + this.config = { + 'backButtonIcon': 'md-arrow-back', + 'iconMode': 'md', + 'tabsPlacement': 'bottom' + }; + } + + this._config.set('tabsPlacement', this.config.tabsPlacement); + this._config.set('iconMode', this.config.iconMode); + this._config.set('backButtonIcon', this.config.backButtonIcon); + } }