Hello everyone. I have this event in home page:
async VerPartido(codigo,pk) {
const alert = await this.Alert.create({
header: 'Codigo del partido',
inputs: [
{
name: 'Codigo',
type: 'text',
placeholder: 'XXX123'
}
],
buttons: [
{
text: 'Ingresar',
handler: (data) => {
console.log(data.Codigo);
if (data.Codigo == codigo){
this.events.publish('partido',pk);
this.NavCtrl.navigateForward('/partido');
} else{
this.ToastError();
}
}
}
]
});
await alert.present();
}
When I getting the event in another page with a subscribe like this:
constructor(public NavCtrl: NavController,
public storage: Storage,
public http: Http,
public Loading: LoadingController,
public events: Events) {
this.events.subscribe('partido', (pk) => {
// user and time are the same arguments passed in `events.publish(user, time)`
console.log('Pk': pk);
});
}
The problem is: The first time not works, but the second time works and i don’t know why. Console throw this message:
Navigation triggered outside Angular zone, did you forget to call ‘ngZone.run()’?
How can i resolve this?