I figured out a solution for this!
The solution is to use the $scope.$on('$stateChangeSuccess')
function. Either check the to/from view with function parameters, or use $location.path()
:
$scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
console.log("State changed: ", toState);
if ($location.path() == "/tab/main") {
$scope.refreshItems();
}
}
@MWright24 the resolve is an interesting idea that may also work.