Angularjs 禁用返回、重新加载/刷新、更改位置/url
如果我的表单仍然无效,或者在上载文件时,如何禁用更改$location或重新加载$locationAngularjs 禁用返回、重新加载/刷新、更改位置/url,angularjs,Angularjs,如果我的表单仍然无效,或者在上载文件时,如何禁用更改$location或重新加载$location windowElement.on('beforeunload', function(event) { if(form === false) { event.preventDefault(); } }); 我也试过了 $scope.$on('$locationChangeStart', function(event) { if(form === false) { event.p
windowElement.on('beforeunload', function(event) {
if(form === false) {
event.preventDefault();
}
});
我也试过了
$scope.$on('$locationChangeStart', function(event) {
if(form === false) {
event.preventDefault();
}
});
及
他们都不工作
$scope.$on('$locationChangeSuccess', function(event) {
if(form === false) {
event.preventDefault();
}
});