これは簡単なことかもしれませんが、私は angularjs の初心者です。これが私のangularjsコントローラーコードです
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) {
}
});
}
MyCtrl1.$inject = ['$scope', '$location', '$rootScope'];
変数には、確認時にリダイレクトするURLがありnext
ます.しかし、angularjsでこれを達成する方法.