app.ts:
import {Component, ViewChild} from ‘@angular/core’;
import {ionicBootstrap, Platform, Nav, Modal, Config} from ‘ionic-angular’;
import {StatusBar} from ‘ionic-native’;
import {TabHide} from ‘./services/tabHide’;
import {TabsPage} from ‘./pages/tabs’;
@Component({
templateUrl:“app.html”
})
export class MyApp {
@ViewChild(Nav) nav: Nav;
private rootPage:any;
constructor(private platform:Platform, public tabhide: TabHide ) {
this.rootPage = TabsPage;
platform.ready().then(() => {
StatusBar.styleDefault();
this.tabhide.changeVis();
});
}
}
ionicBootstrap(MyApp, [TabHide], {tabSubPages:false, scrollAssist:false});
chat-details.ts:
import {Component} from ‘@angular/core’;
import {NavController, NavParams, ViewController} from ‘ionic-angular’;
import {TabHide} from ‘…/…/services/tabHide’;
@Component({
templateUrl: ‘build/pages/chat-details/chat-details.html’,
})
export class ChatDetailsPage {
selectedConversation: any;
messages: Array<{text: string, date: string, from: string}>;
constructor(private nav: NavController,private viewCtrl: ViewController,navParams: NavParams
,public tabhide: TabHide){
tabhide.changeVis();
}
}
tabHide.ts:
import {Injectable} from ‘@angular/core’;
import {Config} from ‘ionic-angular’;
@Injectable()
export class TabHide {
private zone = new NgZone({enableLongStackTrace: false});
constructor(public config: Config) {
console.log("creato tabHide");
}
public changeVis(){
var tabsVisible = this.config.set('ios','tabSubPages','true');
}
}
This are 3 files of my project. When i call tabHide.changeVis() method in MyApp class i can set config properties but when i call the same method in ChatDetailsPage it doesn’t work.