Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49419

Check if back button was used (Ionic 4)

$
0
0

@onfiredigital wrote:

Hi all,

I am trying to work out how I can check if the route was loaded programmatically or if the back button was clicked / pressed instead. I have done some searching but I can’t seem to find anything that is relevant, and the route params don’t seem to contain anything to help my check either.

My reason for this is when my page is loaded we do an API call to retrieve a list of items, but after you click through to the item page then click Back, it does the API call again (using ionViewWillEnter hook).

I could just have the API call in the constructor method so it’s only done once, but in most cases when someone is routed to the page (for example using this.router.navigate(['list']) I actually do want it to trigger so ionViewWillEnter makes more sense.

Any help would be appreciated! Or perhaps a better way of looking at this?

Posts: 5

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 49419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>