0

I have a alert function in controller.js:

function showAlertFinishedTest() {
var confirmPopup = $ionicPopup.confirm({
    title: 'Finished',
    scope: $scope,
    template: 'Are you sure to submit the result?'
});

confirmPopup.then(function(res) {
    if (res) {
        console.log('Submit file json!');
    } else {
        console.log('Get back to the test!');
    }
});
};

How can I redirect to another template when press submit button in if(res){}?

Thanks for all of your answering!

Dean MacGregor
  • 11,847
  • 9
  • 34
  • 72

1 Answers1

0

Inject $state into the controller and use $state.go('[your state name]'); see the doc for UI router here: http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state

iCediCe
  • 1,672
  • 1
  • 15
  • 32