1

I want to execute this code to reset my app when it goes to the app homepage. It works but obviously loops round as it reloads and reloads. What javascript do I need to add to get it to execute only once when it enters the page?

.controller('HomeCtrl', function ($scope, $window) {
$scope.$on('$ionicView.beforeEnter', function() {
**$window.location.reload(true);**
})
})
2
  • 1
    Maybe create a cookie, clear before reload, check for existence of cookie on subsequent page loads? Commented Mar 21, 2016 at 13:32
  • Maybe the problem is in the event (it could be firing multiple times) and not in the reload instruction. Commented Mar 22, 2016 at 20:09

1 Answer 1

0
$route.reload();

this should work.

Sign up to request clarification or add additional context in comments.

1 Comment

Would I need to add $route to or $rootScope to the list of functions on the first line?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.