I am developing with cordova with angular 1.5.6. The simple action of:
$location.path("/someurl");
$window.location.reload();
works in chrome and the android app, but not the ios app. What works across all platforms is doing the reload after the location path has changed.
This is achieved using the $locationChangeSuccess event. Given is a complete controller code so that things are clear. The $location.path is marked, and the $window.location.reload() is placed in the $locationChangeSuccess handler.
angular.module("demo").controller("LoginCtrl", function($scope, $http, $location, $window) {
$scope.dologin = function() {
$scope.message = "";
$http.post(app.baseurl + "/app/login", {
email: $scope.email,
password: $scope.password
},
{
withCredentials: true
}).success(function(response){
$location.path("/dashboard"); // <---
}).error(function(response) {
$scope.message = "invalid user/pass: ";
});
}
$scope.$on('$locationChangeSuccess', function() {
$window.location.reload(true); // <---
});
});
location.reload()
? Might as well just skip$location.path()
– Knotted$window.location
– Knotted