sto ottenendo questo errore durante il tentativo di chiamare
function MyCtrl1($scope, $location, $rootScope) {
$scope.$on('$locationChangeStart', function (event, next, current) {
event.preventDefault();
var answer = confirm("Are you sure you want to leave this page?");
if (answer) {
$location.url($location.url(next).hash());
$rootScope.$apply();
}
});
}
MyCtrl1.$inject = ['$scope', '$location', '$rootScope'];
errore è
Error: $digest already in progress
Questo è un post molto vecchio, ma ancora si può fare riferimento a questo post: http://www.boynux.com/angularjs-apply-explained/ Ho cercato di spiegare $ digest in progress molto semplice. – Boynux