diff --git a/demos/src/config/app.module.ts b/demos/src/config/app.module.ts index 708f3d9d68..03d90d81dc 100644 --- a/demos/src/config/app.module.ts +++ b/demos/src/config/app.module.ts @@ -3,21 +3,21 @@ import { Config, IonicApp, IonicModule, Platform, NavController } from '../../io if (!window.localStorage) { Object.defineProperty(window, 'localStorage', new (function () { - var aKeys = [], oStorage = {}; + var aKeys: any[] = [], oStorage = {}; Object.defineProperty(oStorage, 'getItem', { - value: function (sKey) { return sKey ? this[sKey] : null; }, + value: function (sKey: number) { return sKey ? this[sKey] : null; }, writable: false, configurable: false, enumerable: false }); Object.defineProperty(oStorage, 'key', { - value: function (nKeyId) { return aKeys[nKeyId]; }, + value: function (nKeyId: number) { return aKeys[nKeyId]; }, writable: false, configurable: false, enumerable: false }); Object.defineProperty(oStorage, 'setItem', { - value: function (sKey, sValue) { + value: function (sKey: string, sValue: string) { if (!sKey) { return; } document.cookie = encodeURI(sKey) + '=' + encodeURI(sValue) + '; expires=Tue, 19 Jan 2038 03:14:07 GMT; path=/'; }, @@ -31,7 +31,7 @@ if (!window.localStorage) { enumerable: false }); Object.defineProperty(oStorage, 'removeItem', { - value: function (sKey) { + value: function (sKey: string) { if (!sKey) { return; } document.cookie = encodeURI(sKey) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; }, @@ -40,21 +40,21 @@ if (!window.localStorage) { enumerable: false }); this.get = function () { - var iThisIndx; + var iThisIndx: number; for (var sKey in oStorage) { iThisIndx = aKeys.indexOf(sKey); if (iThisIndx === -1) { - (oStorage as any).setItem(sKey, oStorage[sKey]); + (oStorage as any).setItem(sKey, (oStorage as any)[sKey]); } else { aKeys.splice(iThisIndx, 1); } - delete oStorage[sKey]; + delete (oStorage as any)[sKey]; } for (aKeys; aKeys.length > 0; aKeys.splice(0, 1)) { (oStorage as any).removeItem(aKeys[0]); } - for (var aCouple, iKey, nIdx = 0, aCouples = document.cookie.split(/\s*;\s*/); nIdx < aCouples.length; nIdx++) { + for (var aCouple: any, iKey: any, nIdx = 0, aCouples = document.cookie.split(/\s*;\s*/); nIdx < aCouples.length; nIdx++) { aCouple = aCouples[nIdx].split(/\s*=\s*/); if (aCouple.length > 1) { - oStorage[iKey = decodeURI(aCouple[0])] = decodeURI(aCouple[1]); + (oStorage as any)[iKey = decodeURI(aCouple[0])] = decodeURI(aCouple[1]); aKeys.push(iKey); } } @@ -62,10 +62,10 @@ if (!window.localStorage) { }; this.configurable = false; this.enumerable = true; - })()); + } as any)()); } -var CONFIG_DEMO = null; +var CONFIG_DEMO: any = null; if (window.localStorage.getItem('configDemo')) { CONFIG_DEMO = JSON.parse(window.localStorage.getItem('configDemo')); @@ -88,6 +88,7 @@ export class ApiDemoPage { initialConfig: any; constructor(_config: Config, public navCtrl: NavController) { this.config = _config.settings(); + this.initialConfig = this.config; } diff --git a/demos/src/config/page.html b/demos/src/config/page.html index dbc11dc034..73bda987e3 100644 --- a/demos/src/config/page.html +++ b/demos/src/config/page.html @@ -46,15 +46,20 @@ -

Any config for your app should be passed as the third argument to ionicBootstrap.

+

Any config for your app should be passed as the second argument to IonicModule.forRoot().

-
+@NgModule({ + imports: [ + IonicModule.forRoot(MyApp, { + backButtonIcon: "{{initialConfig?.backButtonIcon}}" + iconMode: "{{initialConfig?.iconMode}}" + tabsPlacement: "{{initialConfig?.tabsPlacement}}" + }) + ] +}) +