Opening another page with Angular and Sweet Alert

Asked

Viewed 137 times

2

I’m trying to open a javascript page with Angularjs. I need that when I click on 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. Below 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');
        }
    });
}

2 answers

3


You can use the $window.open('https://www.google.com', '_blank');

0

I did it, doing it like this:

**$window.location.href = '/#/register/true';**

Browser other questions tagged

You are not signed in. Login or sign up in order to post.