I have fully functional code when i run my ionic application with
ionic lab
ionic emulate ios --prod
but the problem is when i upload it to ionic view OR
if i try to run the app with the following command
ionic emulate ios --prod -lcs // livereload server logs and console logs
Anyways i can’t seem to find the problem or a good way to debug it, here is the code that isn’t working. Basically there are 2 components talking to each other with events. The goal of the components are to have a overlay image helping the user to navigate in the app.
Component 1
import { Component } from '@angular/core';
import { NavController, Events, ViewController } from 'ionic-angular';
@Component({
selector: 'help',
templateUrl: 'help.html'
})
export class HelpComponent {
private img : any;
private hide = true
private helpers = {
"AccountPage": "/assets/helpers/mitt-konto.png",
"PaymentPage": "/assets/helpers/betalningsinformation.png",
"HomePage": "/assets/helpers/kommande-matcher.png",
"GamePage": "/assets/helpers/matchdetaljer.png",
"SupportYourTeamPage": "/assets/helpers/kop-andelar.png",
"MyTeamsPage": "/assets/helpers/mina-lag.png",
"CompletedMatchPage": "/assets/helpers/avslutade-matcher.png",
"SettingsPage": "/assets/helpers/uppdatera-sidan.png"
}
constructor(
public viewCtrl: ViewController,
public events : Events
){
this.events.subscribe('showOverlay:'+this.viewCtrl.name, (name) => {
this.img = this.helpers[name]
this.hide = false
})
}
}
Component 2
import { Component, Input } from '@angular/core';
import { Events, NavController } from 'ionic-angular';
@Component({
selector: 'my-header',
templateUrl: 'header.html'
})
export class HeaderComponent {
@Input('title') title: string;
constructor(public events: Events, public navCtrl: NavController) {}
showHelp(){
this.events.publish('showOverlay:'+this.navCtrl.getActive().name, this.navCtrl.getActive().name);
}
}