I'm trying to open a page in javascript with angularjs. I need when I click on the bt it asks a question and depending on the result, open a link with the url true or false. I can do this, but the page only opens if I click the button again. Here is the code:
$scope.hasCodeIndication = function() {
// $location.path('/register/true');
swal({
title: 'Código de indicação',
text: 'Possuo código de indicação?',
confirmButtonText: 'Sim',
confirmButtonColor: '#16824d',
closeOnConfirm: true,
cancelButtonText: 'Não',
showCancelButton: true,
closeOnCancel: true,
html: true
},
function(isConfirm) {
if (isConfirm) {
$location.path('/register/true');
} else {
$location.path('/register/false');
}
});
}