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!
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