Ah interesting. Im not too familiar with promises. Thought the Promise.resolve
was mandatory. I removed that but the problem still persists.
As for the race condition.
- This is not the first page that loads and settingsService is initialized before.
- At this point settings were inited in a pervious run of the app, and stored in DB, so
initSetting
is really doing nothing.
I think there might be a problem with my setup.
This are my tabs from where I goto the settings:
TS:
import {Alert, Page, NavController, NavParams} from 'ionic-angular';
// Import Local Pages
import {SettingsPage} from '../settings/settings';
// Import Local Services
import {SettingsService} from '../../model/settings/settings.service.ts';
@Page({
templateUrl: 'build/pages/app-tabs/app-tabs.html',
})
export class AppTabsPage {
tabSettings = SettingsPage;
constructor(
private nav: NavController,
navParams: NavParams,
private _settingsService: SettingsService
) {
}
}
and HTML:
<ion-tabs>
<ion-tab tabIcon="settings" tabTitle="Settings" [root]="tabSettings" ></ion-tab>
</ion-tabs>
Also my app:
import 'es6-shim';
import {App, IonicApp, Platform, MenuController} from 'ionic-angular';
import {StatusBar} from 'ionic-native';
// Import Local Root Page
import {AppTabsPage} from './pages/app-tabs/app-tabs';
// Import Local Services
import {SettingsService} from './model/settings/settings.service.ts';
@App({
templateUrl: 'build/app.html',
providers: [
SettingsService,
],
config: {} // http://ionicframework.com/docs/v2/api/config/Config/
})
class MyApp {
appTabsPage = AppTabsPage;
constructor(
private app: IonicApp,
private platform: Platform,
private menu: MenuController
) {
this.initializeApp();
}
initializeApp() {
this.platform.ready().then(() => {
// Okay, so the platform is ready and our plugins are available.
// Here you can do any higher level native things you might need.
StatusBar.styleDefault();
});
}
}
and HTML:
<ion-nav id="nav" [root]="appTabsPage" swipe-back-enabled="false"></ion-nav>
NOTE:
When I double click on the tab, the tab refreshes with the correct settings, but this does not happen dynamically
This is my ionic info output btw:
(node:15173) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Your system information:
Cordova CLI: You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.2.0
Ionic Framework Version: 2.0.0-beta.7
Ionic CLI Version: 2.0.0-beta.25
Ionic App Lib Version: 2.0.0-beta.15
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X Yosemite
Node Version: v6.2.0
Xcode version: Xcode 7.2 Build version 7C68
******************************************************
Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:
Please install your Cordova CLI to version >=4.2.0 `npm install -g cordova`
******************************************************