hi there,
is use ionic 4 (all is up to date - today ;)) and i’ll use the Events (https://ionicframework.com/docs/api/util/Events/):
i trigger the event in the app.component.ts
changeCategory(category: Category) {
console.log("event trigger from app");
this.events.publish("category:changed", category);
}
and listen in the first page
constructor(public events: Events) {
this.subscribeEvents(events);
}
subscribeEvents(events: Events) {
events.subscribe("category:changed", (category) => {
// only executed from 'event trigger from news' not from 'event trigger from app'
console.log("category from news page");
console.log(category);
});
console.log("event trigger from news");
this.events.publish("category:changed", "hi");
}
what is my mistake?
greets
lars