Opening another page with Angular and Sweet Alert

2

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');
        }
    });
}
    
asked by anonymous 07.11.2016 / 18:54

2 answers

3

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

    
07.11.2016 / 19:00
0

I succeeded by doing this:

**$window.location.href = '/#/register/true';**
    
07.11.2016 / 19:52