Refresh current page


#1

Hi guys,
I need to refresh my current page after event occurred.

I retrieve the current page but I can’t refresh it?

var currentPage = this.nav.getActive().name;

Thanks
Luca


#2

Hi, what do you want to refresh your entire page?


#3

I need to reload the entire page… constructor, etc etc…


#4

That’s not how Angular applications work. What is the actual goal here?


#5

In my constructor I reed the storage… when a specific event triggered, I need to reload the storage and refresh the page


#6

If you actually have to “refresh the page”, then something is drastically wrong. As for reloading from storage, do something like this:

thingy: string;

constructor(private _storage: Storage, events: Events) {
  this.refresh(); 
  events.subscribe('thingyChanged', () => this.refresh());
}

refresh(): void {
  this._storage.get('thingy').then(thingy => this.thingy = thingy);
}

I have to warn you, though: every time I’ve needed something like this, I ended up throwing the design in the trash bin in favor of some other more robust solution. It’s too error-prone to rely on storage as an intermediary like this. Storage should only be used across app restarts, IMHO.