Hi everyone, I’m trying to run a controller function whenever a tab is shown to the user. I’m using ion-tabs to build my interface and it works fine.
I found however that using ng-init in one of my views only triggers once. I’m not saying I want to use ng-init, but rather prefer a good way of running some code whenever a user opens a specific ion-tab.
Any ideas? Right now, my tabs only route to the correct partial:
<ion-tab title="Something" icon="ion-ios7-circle-filled" ui-sref="tabs.something">
<ion-nav-view name="something-tab"></ion-nav-view>
</ion-tab>
In the partials I’m calling a function through ng-init (although I’ve learned that this is not the way to go.
The reason I want to launch some code whenever a user tabs a certain ion-tab, is that I need to push their current location to the server. Right now this works, but only the first time the ion-tab opens. When a user is idle for an hour or so and then relaunches that tab, it should update his or her location.
Thanks for any advice you could give me.