我在尝试调用时收到此错误
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'];
错误是
Error: $digest already in progress