Page does not update after receiving an event updates the local state
Ionic version: (check one with "x") [ ] 1.x [X ] 2.x
I'm submitting a ... (check one with "x") [X ] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
Given I am on a page that is subscribing on an event When I have a background Observer.interval polling and fire an event The page receives the event, I update local state object However the page does not refresh the new state unless I do a NavCtrl.setRoot and unsubscribe the event.
Expected behavior:
Given I am on a page that is subscribing on an event When I have a background Observer.interval polling and fire an event I expect the page to receive the event and the page to update the View with new information Steps to reproduce:
Related code:
let timer = Observable.interval(1000)
.subscribe(() => {
myAPI.call()
.subscribe((result) => {
if (result.status === 'OK') {
event.publish(MyEvent);
contextService().getContext.result = result;
timer.unsubscribe();
}
....
Then in the page
//state object
public result:<any>;
constructor(public events:Events, public contextService:ContextService) {
this.evens.subscribe(MyEvent, () => {
this.result = this.contextService().getContext().result;
});
}
Other information:
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
insert the output from ionic info here
Thanks for the issue! This issue is being closed due to inactivity. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Thank you for using Ionic!