Skip to content

Commit

Permalink
fix(demos/config) fix for config page not updating. ionic-team#9413
Browse files Browse the repository at this point in the history
  • Loading branch information
ncapito committed Jan 14, 2017
1 parent 9168bc1 commit 4a4ac59
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions demos/src/config/app.module.ts
Original file line number Diff line number Diff line change
@@ -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 () {
Expand Down Expand Up @@ -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();
Expand All @@ -140,7 +117,36 @@ export class PushPage {
template: '<ion-nav [root]="root" #content></ion-nav>'
})
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);
}
}


Expand Down

0 comments on commit 4a4ac59

Please sign in to comment.